Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
1991864264
@ -1,38 +1,77 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>mutation-testing</artifactId>
|
<artifactId>mutation-testing</artifactId>
|
||||||
<version>0.1-SNAPSHOT</version>
|
<version>0.1-SNAPSHOT</version>
|
||||||
<name>mutation-testing</name>
|
<name>mutation-testing</name>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.pitest</groupId>
|
<groupId>org.pitest</groupId>
|
||||||
<artifactId>pitest-parent</artifactId>
|
<artifactId>pitest-parent</artifactId>
|
||||||
<version>1.1.10</version>
|
<version>1.1.10</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.9</version>
|
<version>4.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.pitest</groupId>
|
<groupId>org.pitest</groupId>
|
||||||
<artifactId>pitest-maven</artifactId>
|
<artifactId>pitest-maven</artifactId>
|
||||||
<version>1.1.10</version>
|
<version>1.1.10</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<targetClasses>
|
<targetClasses>
|
||||||
<param>com.baeldung.testing.mutation.*</param>
|
<param>com.baeldung.testing.mutation.*</param>
|
||||||
</targetClasses>
|
</targetClasses>
|
||||||
<targetTests>
|
<targetTests>
|
||||||
<param>com.baeldung.mutation.test.*</param>
|
<param>com.baeldung.mutation.test.*</param>
|
||||||
</targetTests>
|
</targetTests>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
<plugin>
|
||||||
</build>
|
<groupId>org.jacoco</groupId>
|
||||||
</project>
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
|
<version>0.7.7.201606060606</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>prepare-agent</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>report</id>
|
||||||
|
<phase>prepare-package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>report</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>jacoco-check</id>
|
||||||
|
<goals>
|
||||||
|
<goal>check</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<rules>
|
||||||
|
<rule>
|
||||||
|
<element>PACKAGE</element>
|
||||||
|
<limits>
|
||||||
|
<limit>
|
||||||
|
<counter>LINE</counter>
|
||||||
|
<value>COVEREDRATIO</value>
|
||||||
|
<minimum>0.50</minimum>
|
||||||
|
</limit>
|
||||||
|
</limits>
|
||||||
|
</rule>
|
||||||
|
</rules>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
|
@ -8,21 +8,26 @@ import org.junit.Test;
|
|||||||
import com.baeldung.testing.mutation.Palindrome;
|
import com.baeldung.testing.mutation.Palindrome;
|
||||||
|
|
||||||
public class TestPalindrome {
|
public class TestPalindrome {
|
||||||
|
@Test
|
||||||
|
public void whenEmptyString_thanAccept() {
|
||||||
|
Palindrome palindromeTester = new Palindrome();
|
||||||
|
assertTrue(palindromeTester.isPalindrome("noon"));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void acceptsPalindrome() {
|
public void whenPalindrom_thanAccept() {
|
||||||
Palindrome palindromeTester = new Palindrome();
|
Palindrome palindromeTester = new Palindrome();
|
||||||
assertTrue(palindromeTester.isPalindrome("noon"));
|
assertTrue(palindromeTester.isPalindrome("noon"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void rejectsNonPalindrome(){
|
public void whenNotPalindrom_thanReject(){
|
||||||
Palindrome palindromeTester = new Palindrome();
|
Palindrome palindromeTester = new Palindrome();
|
||||||
assertFalse(palindromeTester.isPalindrome("box"));
|
assertFalse(palindromeTester.isPalindrome("box"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void rejectsNearPalindrome(){
|
public void whenNearPalindrom_thanReject(){
|
||||||
Palindrome palindromeTester = new Palindrome();
|
Palindrome palindromeTester = new Palindrome();
|
||||||
assertFalse(palindromeTester.isPalindrome("neon"));
|
assertFalse(palindromeTester.isPalindrome("neon"));
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
|||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@SpringApplicationConfiguration(classes = ConfigClient.class)
|
@SpringApplicationConfiguration(classes = ConfigClient.class)
|
||||||
@WebAppConfiguration
|
@WebAppConfiguration
|
||||||
@Ignore
|
public class ConfigClientLiveTest {
|
||||||
public class ConfigClientTests {
|
|
||||||
@Test
|
@Test
|
||||||
public void contextLoads() {
|
public void contextLoads() {
|
||||||
}
|
}
|
@ -18,4 +18,25 @@
|
|||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>1.3.5.RELEASE</version>
|
<version>1.3.5.RELEASE</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>${maven-surefire-plugin.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>**/*LiveTest.java</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<org.springframework.boot.version>1.3.5.RELEASE</org.springframework.boot.version>
|
||||||
|
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
|
||||||
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
@ -11,7 +11,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
|||||||
@SpringApplicationConfiguration(classes = ConfigServer.class)
|
@SpringApplicationConfiguration(classes = ConfigServer.class)
|
||||||
@WebAppConfiguration
|
@WebAppConfiguration
|
||||||
@Ignore
|
@Ignore
|
||||||
public class ConfigServerTests {
|
public class ConfigServerListTest {
|
||||||
@Test
|
@Test
|
||||||
public void contextLoads() {
|
public void contextLoads() {
|
||||||
}
|
}
|
@ -4,6 +4,8 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
import org.springframework.boot.context.web.SpringBootServletInitializer;
|
import org.springframework.boot.context.web.SpringBootServletInitializer;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class SpringDemoApplication extends SpringBootServletInitializer {
|
public class SpringDemoApplication extends SpringBootServletInitializer {
|
||||||
@ -16,4 +18,9 @@ public class SpringDemoApplication extends SpringBootServletInitializer {
|
|||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
return application.sources(SpringDemoApplication.class);
|
return application.sources(SpringDemoApplication.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RestTemplate getRestTemplate(){
|
||||||
|
return new RestTemplate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.IntegrationTest;
|
import org.springframework.boot.test.IntegrationTest;
|
||||||
import org.springframework.boot.test.SpringApplicationContextLoader;
|
import org.springframework.boot.test.SpringApplicationContextLoader;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
@ -21,7 +22,8 @@ import org.springframework.web.client.RestTemplate;
|
|||||||
public class SpringIntegrationTest {
|
public class SpringIntegrationTest {
|
||||||
protected static ResponseResults latestResponse = null;
|
protected static ResponseResults latestResponse = null;
|
||||||
|
|
||||||
protected RestTemplate restTemplate = null;
|
@Autowired
|
||||||
|
protected RestTemplate restTemplate;
|
||||||
|
|
||||||
protected void executeGet(String url) throws IOException {
|
protected void executeGet(String url) throws IOException {
|
||||||
final Map<String, String> headers = new HashMap<>();
|
final Map<String, String> headers = new HashMap<>();
|
||||||
@ -29,10 +31,6 @@ public class SpringIntegrationTest {
|
|||||||
final HeaderSettingRequestCallback requestCallback = new HeaderSettingRequestCallback(headers);
|
final HeaderSettingRequestCallback requestCallback = new HeaderSettingRequestCallback(headers);
|
||||||
final ResponseResultErrorHandler errorHandler = new ResponseResultErrorHandler();
|
final ResponseResultErrorHandler errorHandler = new ResponseResultErrorHandler();
|
||||||
|
|
||||||
if (restTemplate == null) {
|
|
||||||
restTemplate = new RestTemplate();
|
|
||||||
}
|
|
||||||
|
|
||||||
restTemplate.setErrorHandler(errorHandler);
|
restTemplate.setErrorHandler(errorHandler);
|
||||||
latestResponse = restTemplate.execute(url, HttpMethod.GET, requestCallback, new ResponseExtractor<ResponseResults>() {
|
latestResponse = restTemplate.execute(url, HttpMethod.GET, requestCallback, new ResponseExtractor<ResponseResults>() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user