diff --git a/mutation-testing/pom.xml b/mutation-testing/pom.xml index 83012ab8fe..cdee59fcb4 100644 --- a/mutation-testing/pom.xml +++ b/mutation-testing/pom.xml @@ -1,38 +1,77 @@ - 4.0.0 - com.baeldung - mutation-testing - 0.1-SNAPSHOT - mutation-testing - - - org.pitest - pitest-parent - 1.1.10 - pom - - - junit - junit - 4.9 - - - - - - org.pitest - pitest-maven - 1.1.10 - - - com.baeldung.testing.mutation.* - - - com.baeldung.mutation.test.* - - - - - - \ No newline at end of file + 4.0.0 + com.baeldung + mutation-testing + 0.1-SNAPSHOT + mutation-testing + + + org.pitest + pitest-parent + 1.1.10 + pom + + + junit + junit + 4.9 + + + + + + org.pitest + pitest-maven + 1.1.10 + + + com.baeldung.testing.mutation.* + + + com.baeldung.mutation.test.* + + + + + org.jacoco + jacoco-maven-plugin + 0.7.7.201606060606 + + + + prepare-agent + + + + report + prepare-package + + report + + + + jacoco-check + + check + + + + + PACKAGE + + + LINE + COVEREDRATIO + 0.50 + + + + + + + + + + + diff --git a/mutation-testing/src/test/java/com/baeldung/mutation/test/TestPalindrome.java b/mutation-testing/src/test/java/com/baeldung/mutation/test/TestPalindrome.java index 1410135883..3add6290f6 100644 --- a/mutation-testing/src/test/java/com/baeldung/mutation/test/TestPalindrome.java +++ b/mutation-testing/src/test/java/com/baeldung/mutation/test/TestPalindrome.java @@ -8,21 +8,26 @@ import org.junit.Test; import com.baeldung.testing.mutation.Palindrome; public class TestPalindrome { + @Test + public void whenEmptyString_thanAccept() { + Palindrome palindromeTester = new Palindrome(); + assertTrue(palindromeTester.isPalindrome("noon")); + } @Test - public void acceptsPalindrome() { + public void whenPalindrom_thanAccept() { Palindrome palindromeTester = new Palindrome(); assertTrue(palindromeTester.isPalindrome("noon")); } @Test - public void rejectsNonPalindrome(){ + public void whenNotPalindrom_thanReject(){ Palindrome palindromeTester = new Palindrome(); assertFalse(palindromeTester.isPalindrome("box")); } @Test - public void rejectsNearPalindrome(){ + public void whenNearPalindrom_thanReject(){ Palindrome palindromeTester = new Palindrome(); assertFalse(palindromeTester.isPalindrome("neon")); } diff --git a/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java b/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientLiveTest.java similarity index 92% rename from spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java rename to spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientLiveTest.java index efe359904c..058fd45f35 100644 --- a/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientTests.java +++ b/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientLiveTest.java @@ -10,8 +10,7 @@ import org.springframework.test.context.web.WebAppConfiguration; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = ConfigClient.class) @WebAppConfiguration -@Ignore -public class ConfigClientTests { +public class ConfigClientLiveTest { @Test public void contextLoads() { } diff --git a/spring-cloud-config/pom.xml b/spring-cloud-config/pom.xml index bce1fb3fa4..8e0e4b8706 100644 --- a/spring-cloud-config/pom.xml +++ b/spring-cloud-config/pom.xml @@ -18,4 +18,25 @@ spring-boot-starter-parent 1.3.5.RELEASE + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + **/*LiveTest.java + + + + + + + + + 1.3.5.RELEASE + 2.19.1 + diff --git a/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java b/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerListTest.java similarity index 93% rename from spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java rename to spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerListTest.java index 9e0b6f91e7..306c120e43 100644 --- a/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerTests.java +++ b/spring-cloud-config/server/src/test/java/com/baeldung/spring/cloud/config/server/ConfigServerListTest.java @@ -11,7 +11,7 @@ import org.springframework.test.context.web.WebAppConfiguration; @SpringApplicationConfiguration(classes = ConfigServer.class) @WebAppConfiguration @Ignore -public class ConfigServerTests { +public class ConfigServerListTest { @Test public void contextLoads() { } diff --git a/spring-cucumber/src/main/java/com/baeldung/SpringDemoApplication.java b/spring-cucumber/src/main/java/com/baeldung/SpringDemoApplication.java index ecb8909de9..60548dd6e3 100644 --- a/spring-cucumber/src/main/java/com/baeldung/SpringDemoApplication.java +++ b/spring-cucumber/src/main/java/com/baeldung/SpringDemoApplication.java @@ -4,6 +4,8 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.SpringBootServletInitializer; +import org.springframework.context.annotation.Bean; +import org.springframework.web.client.RestTemplate; @SpringBootApplication public class SpringDemoApplication extends SpringBootServletInitializer { @@ -16,4 +18,9 @@ public class SpringDemoApplication extends SpringBootServletInitializer { protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(SpringDemoApplication.class); } + + @Bean + public RestTemplate getRestTemplate(){ + return new RestTemplate(); + } } diff --git a/spring-cucumber/src/test/java/com/baeldung/SpringIntegrationTest.java b/spring-cucumber/src/test/java/com/baeldung/SpringIntegrationTest.java index e37b203c07..34efff63fb 100644 --- a/spring-cucumber/src/test/java/com/baeldung/SpringIntegrationTest.java +++ b/spring-cucumber/src/test/java/com/baeldung/SpringIntegrationTest.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.IntegrationTest; import org.springframework.boot.test.SpringApplicationContextLoader; import org.springframework.http.HttpMethod; @@ -21,7 +22,8 @@ import org.springframework.web.client.RestTemplate; public class SpringIntegrationTest { protected static ResponseResults latestResponse = null; - protected RestTemplate restTemplate = null; + @Autowired + protected RestTemplate restTemplate; protected void executeGet(String url) throws IOException { final Map headers = new HashMap<>(); @@ -29,10 +31,6 @@ public class SpringIntegrationTest { final HeaderSettingRequestCallback requestCallback = new HeaderSettingRequestCallback(headers); final ResponseResultErrorHandler errorHandler = new ResponseResultErrorHandler(); - if (restTemplate == null) { - restTemplate = new RestTemplate(); - } - restTemplate.setErrorHandler(errorHandler); latestResponse = restTemplate.execute(url, HttpMethod.GET, requestCallback, new ResponseExtractor() { @Override