From 2e683411e223c67c26ffb50385d78d8bebfe965a Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Tue, 5 Jun 2018 17:05:55 +0530 Subject: [PATCH] Bael 4461 2 (#4409) * Deleted md file as a conflict * [BAEL-4461] - Fixed PMD violation * [BAEL-4461] - Fixed PMD violation * [BAEL-4461] - Ignore empty TC * Fix Spring 5 tests --- ...t.java => CayenneAdvancedOperationLiveTest.java} | 2 +- ...ationTest.java => CayenneOperationLiveTest.java} | 2 +- ...ts.java => AzureApplicationIntegrationTest.java} | 2 +- ...amNameTest.java => MethodParamNameUnitTest.java} | 2 +- .../java/com/baeldung/file/FilesManualTest.java | 2 +- .../baeldung/java/io/JavaReadFromFileUnitTest.java | 2 +- ...Test.java => FlipControllerIntegrationTest.java} | 2 +- ...ceTest.java => TodoMustacheServiceUnitTest.java} | 2 +- ...Test.java => FlipControllerIntegrationTest.java} | 2 +- .../com/baeldung/persistence/FooRepository.java | 3 +-- .../main/java/com/baeldung/web/FooController.java | 6 ++++++ .../java/com/baeldung/Example1IntegrationTest.java | 2 ++ .../java/com/baeldung/Example2IntegrationTest.java | 2 ++ .../baeldung/Spring5ApplicationIntegrationTest.java | 2 ++ .../functional/BeanRegistrationIntegrationTest.java | 2 ++ .../jdbc/autogenkey/GetAutoGenKeyByJDBC.java | 2 ++ .../com/baeldung/jsonb/JsonbIntegrationTest.java | 12 +++++------- .../baeldung/security/SecurityIntegrationTest.java | 2 ++ .../web/client/WebTestClientIntegrationTest.java | 2 ++ ...=> PassParametersControllerIntegrationTest.java} | 2 +- ...ctionalTest.java => ITransactionalUnitTest.java} | 4 ++-- .../TransactionalIntegrationTest.java | 2 +- spring-boot-ops/README.MD | 13 ------------- spring-boot-ops/README.md | 12 ------------ ...ubernetesBackendApplicationIntegrationTest.java} | 2 +- ...bernetesFrontendApplicationIntegrationTest.java} | 2 +- ...lerTest.java => AuthorEventHandlerUnitTest.java} | 2 +- ...ndlerTest.java => BookEventHandlerUnitTest.java} | 2 +- ...ava => SimpleBookControllerIntegrationTest.java} | 2 +- ...=> SimpleBookRestControllerIntegrationTest.java} | 2 +- .../{ConfigTest.java => ConfigIntegrationTest.java} | 4 ++-- .../baeldung/web/FooDiscoverabilityLiveTest.java | 4 ++-- .../src/test/java/org/baeldung/web/FooLiveTest.java | 4 ++-- .../java/org/baeldung/web/FooPageableLiveTest.java | 4 ++-- ...ditorTest.java => CreditCardEditorUnitTest.java} | 2 +- ...ecurityThymeleafApplicationIntegrationTest.java} | 2 +- .../future/{FutureTest.java => FutureUnitTest.java} | 2 +- 37 files changed, 56 insertions(+), 64 deletions(-) rename apache-cayenne/src/test/java/com/baeldung/apachecayenne/{CayenneAdvancedOperationIntegrationTest.java => CayenneAdvancedOperationLiveTest.java} (99%) rename apache-cayenne/src/test/java/com/baeldung/apachecayenne/{CayenneOperationIntegrationTest.java => CayenneOperationLiveTest.java} (98%) rename azure/src/test/java/com/baeldung/springboot/azure/{AzureApplicationTests.java => AzureApplicationIntegrationTest.java} (86%) rename core-java-8/src/test/java/com/baeldung/reflect/{MethodParamNameTest.java => MethodParamNameUnitTest.java} (93%) rename flips/src/test/java/com/baeldung/flips/controller/{FlipControllerTest.java => FlipControllerIntegrationTest.java} (98%) rename mustache/src/test/java/com/baeldung/mustache/{TodoMustacheServiceTest.java => TodoMustacheServiceUnitTest.java} (98%) rename spring-4/src/test/java/com/baeldung/flips/controller/{FlipControllerTest.java => FlipControllerIntegrationTest.java} (98%) rename spring-all/src/test/java/org/baeldung/controller/{PassParametersControllerTest.java => PassParametersControllerIntegrationTest.java} (97%) rename spring-all/src/test/java/org/baeldung/spring43/defaultmethods/{ITransactionalTest.java => ITransactionalUnitTest.java} (80%) delete mode 100644 spring-boot-ops/README.MD delete mode 100644 spring-boot-ops/README.md rename spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/{KubernetesBackendApplicationTests.java => KubernetesBackendApplicationIntegrationTest.java} (84%) rename spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/{KubernetesFrontendApplicationTests.java => KubernetesFrontendApplicationIntegrationTest.java} (84%) rename spring-data-rest/src/test/java/com/baeldung/events/{AuthorEventHandlerTest.java => AuthorEventHandlerUnitTest.java} (95%) rename spring-data-rest/src/test/java/com/baeldung/events/{BookEventHandlerTest.java => BookEventHandlerUnitTest.java} (95%) rename spring-mvc-java/src/test/java/com/baeldung/web/controller/{SimpleBookControllerTest.java => SimpleBookControllerIntegrationTest.java} (95%) rename spring-mvc-java/src/test/java/com/baeldung/web/controller/{SimpleBookRestControllerTest.java => SimpleBookRestControllerIntegrationTest.java} (95%) rename spring-rest-full/src/test/java/org/baeldung/spring/{ConfigTest.java => ConfigIntegrationTest.java} (75%) rename spring-rest/src/test/java/com/baeldung/propertyeditor/creditcard/{CreditCardEditorTest.java => CreditCardEditorUnitTest.java} (97%) rename spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/{SpringSecurityThymeleafApplicationTests.java => SpringSecurityThymeleafApplicationIntegrationTest.java} (90%) rename vavr/src/test/java/com/baeldung/vavr/future/{FutureTest.java => FutureUnitTest.java} (99%) diff --git a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationIntegrationTest.java b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationLiveTest.java similarity index 99% rename from apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationIntegrationTest.java rename to apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationLiveTest.java index 546b8fe45c..b54b62ca02 100644 --- a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationIntegrationTest.java +++ b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneAdvancedOperationLiveTest.java @@ -19,7 +19,7 @@ import java.util.List; import static junit.framework.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -public class CayenneAdvancedOperationIntegrationTest { +public class CayenneAdvancedOperationLiveTest { private static ObjectContext context = null; @BeforeClass diff --git a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationIntegrationTest.java b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationLiveTest.java similarity index 98% rename from apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationIntegrationTest.java rename to apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationLiveTest.java index 85f06d5538..e6ca4a3634 100644 --- a/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationIntegrationTest.java +++ b/apache-cayenne/src/test/java/com/baeldung/apachecayenne/CayenneOperationLiveTest.java @@ -16,7 +16,7 @@ import static junit.framework.Assert.assertEquals; import static org.junit.Assert.assertNull; -public class CayenneOperationIntegrationTest { +public class CayenneOperationLiveTest { private static ObjectContext context = null; @BeforeClass diff --git a/azure/src/test/java/com/baeldung/springboot/azure/AzureApplicationTests.java b/azure/src/test/java/com/baeldung/springboot/azure/AzureApplicationIntegrationTest.java similarity index 86% rename from azure/src/test/java/com/baeldung/springboot/azure/AzureApplicationTests.java rename to azure/src/test/java/com/baeldung/springboot/azure/AzureApplicationIntegrationTest.java index 91632be11a..7c3084446f 100644 --- a/azure/src/test/java/com/baeldung/springboot/azure/AzureApplicationTests.java +++ b/azure/src/test/java/com/baeldung/springboot/azure/AzureApplicationIntegrationTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class AzureApplicationTests { +public class AzureApplicationIntegrationTest { @Test public void contextLoads() { diff --git a/core-java-8/src/test/java/com/baeldung/reflect/MethodParamNameTest.java b/core-java-8/src/test/java/com/baeldung/reflect/MethodParamNameUnitTest.java similarity index 93% rename from core-java-8/src/test/java/com/baeldung/reflect/MethodParamNameTest.java rename to core-java-8/src/test/java/com/baeldung/reflect/MethodParamNameUnitTest.java index 46c833cfb1..b191c94826 100644 --- a/core-java-8/src/test/java/com/baeldung/reflect/MethodParamNameTest.java +++ b/core-java-8/src/test/java/com/baeldung/reflect/MethodParamNameUnitTest.java @@ -9,7 +9,7 @@ import java.util.Optional; import org.junit.Test; -public class MethodParamNameTest { +public class MethodParamNameUnitTest { @Test public void whenGetConstructorParams_thenOk() diff --git a/core-java-io/src/test/java/com/baeldung/file/FilesManualTest.java b/core-java-io/src/test/java/com/baeldung/file/FilesManualTest.java index 8322106c24..f5c5c3dd3a 100644 --- a/core-java-io/src/test/java/com/baeldung/file/FilesManualTest.java +++ b/core-java-io/src/test/java/com/baeldung/file/FilesManualTest.java @@ -77,6 +77,6 @@ public class FilesManualTest { bw.newLine(); bw.close(); - assertThat(StreamUtils.getStringFromInputStream(new FileInputStream(fileName))).isEqualTo("UK\r\n" + "US\r\n" + "Germany\r\n" + "Spain\n"); + assertThat(StreamUtils.getStringFromInputStream(new FileInputStream(fileName))).isEqualTo("UK\r\n" + "US\r\n" + "Germany\r\n" + "Spain\r\n"); } } \ No newline at end of file diff --git a/core-java-io/src/test/java/org/baeldung/java/io/JavaReadFromFileUnitTest.java b/core-java-io/src/test/java/org/baeldung/java/io/JavaReadFromFileUnitTest.java index b56841117e..0945a21b1b 100644 --- a/core-java-io/src/test/java/org/baeldung/java/io/JavaReadFromFileUnitTest.java +++ b/core-java-io/src/test/java/org/baeldung/java/io/JavaReadFromFileUnitTest.java @@ -106,7 +106,7 @@ public class JavaReadFromFileUnitTest { @Test public void whenReadUTFEncodedFile_thenCorrect() throws IOException { - final String expected_value = "é�’空"; + final String expected_value = "青空"; final BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("src/test/resources/test_read7.in"), "UTF-8")); final String currentLine = reader.readLine(); reader.close(); diff --git a/flips/src/test/java/com/baeldung/flips/controller/FlipControllerTest.java b/flips/src/test/java/com/baeldung/flips/controller/FlipControllerIntegrationTest.java similarity index 98% rename from flips/src/test/java/com/baeldung/flips/controller/FlipControllerTest.java rename to flips/src/test/java/com/baeldung/flips/controller/FlipControllerIntegrationTest.java index 8fd9c4e340..9dd4ef064a 100644 --- a/flips/src/test/java/com/baeldung/flips/controller/FlipControllerTest.java +++ b/flips/src/test/java/com/baeldung/flips/controller/FlipControllerIntegrationTest.java @@ -23,7 +23,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers; }, webEnvironment = SpringBootTest.WebEnvironment.MOCK) @AutoConfigureMockMvc @ActiveProfiles("dev") -public class FlipControllerTest { +public class FlipControllerIntegrationTest { @Autowired private MockMvc mvc; diff --git a/mustache/src/test/java/com/baeldung/mustache/TodoMustacheServiceTest.java b/mustache/src/test/java/com/baeldung/mustache/TodoMustacheServiceUnitTest.java similarity index 98% rename from mustache/src/test/java/com/baeldung/mustache/TodoMustacheServiceTest.java rename to mustache/src/test/java/com/baeldung/mustache/TodoMustacheServiceUnitTest.java index 0df2f7f8a4..0c192b30bc 100644 --- a/mustache/src/test/java/com/baeldung/mustache/TodoMustacheServiceTest.java +++ b/mustache/src/test/java/com/baeldung/mustache/TodoMustacheServiceUnitTest.java @@ -15,7 +15,7 @@ import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; -public class TodoMustacheServiceTest { +public class TodoMustacheServiceUnitTest { private String executeTemplate(Mustache m, Map context) throws IOException { StringWriter writer = new StringWriter(); diff --git a/spring-4/src/test/java/com/baeldung/flips/controller/FlipControllerTest.java b/spring-4/src/test/java/com/baeldung/flips/controller/FlipControllerIntegrationTest.java similarity index 98% rename from spring-4/src/test/java/com/baeldung/flips/controller/FlipControllerTest.java rename to spring-4/src/test/java/com/baeldung/flips/controller/FlipControllerIntegrationTest.java index 8fd9c4e340..9dd4ef064a 100644 --- a/spring-4/src/test/java/com/baeldung/flips/controller/FlipControllerTest.java +++ b/spring-4/src/test/java/com/baeldung/flips/controller/FlipControllerIntegrationTest.java @@ -23,7 +23,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers; }, webEnvironment = SpringBootTest.WebEnvironment.MOCK) @AutoConfigureMockMvc @ActiveProfiles("dev") -public class FlipControllerTest { +public class FlipControllerIntegrationTest { @Autowired private MockMvc mvc; diff --git a/spring-5/src/main/java/com/baeldung/persistence/FooRepository.java b/spring-5/src/main/java/com/baeldung/persistence/FooRepository.java index 1f1e071158..9270d58d35 100644 --- a/spring-5/src/main/java/com/baeldung/persistence/FooRepository.java +++ b/spring-5/src/main/java/com/baeldung/persistence/FooRepository.java @@ -1,10 +1,9 @@ package com.baeldung.persistence; +import com.baeldung.web.Foo; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; -import com.baeldung.web.Foo; - public interface FooRepository extends JpaRepository, JpaSpecificationExecutor { } diff --git a/spring-5/src/main/java/com/baeldung/web/FooController.java b/spring-5/src/main/java/com/baeldung/web/FooController.java index 925f2b49f4..a09e628421 100644 --- a/spring-5/src/main/java/com/baeldung/web/FooController.java +++ b/spring-5/src/main/java/com/baeldung/web/FooController.java @@ -7,6 +7,7 @@ import org.springframework.http.HttpStatus; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import javax.annotation.PostConstruct; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import java.util.List; @@ -14,6 +15,11 @@ import java.util.List; @RestController("/foos") public class FooController { + @PostConstruct + public void init(){ + System.out.println("test"); + } + @Autowired private FooRepository repo; diff --git a/spring-5/src/test/java/com/baeldung/Example1IntegrationTest.java b/spring-5/src/test/java/com/baeldung/Example1IntegrationTest.java index 8b9e66213f..ecc677465e 100644 --- a/spring-5/src/test/java/com/baeldung/Example1IntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/Example1IntegrationTest.java @@ -3,10 +3,12 @@ package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest +@EnableJpaRepositories("com.baeldung.persistence") public class Example1IntegrationTest { @Test diff --git a/spring-5/src/test/java/com/baeldung/Example2IntegrationTest.java b/spring-5/src/test/java/com/baeldung/Example2IntegrationTest.java index 6ed53ca4e9..e1d56c2fc3 100644 --- a/spring-5/src/test/java/com/baeldung/Example2IntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/Example2IntegrationTest.java @@ -3,10 +3,12 @@ package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest +@EnableJpaRepositories("com.baeldung.persistence") public class Example2IntegrationTest { @Test diff --git a/spring-5/src/test/java/com/baeldung/Spring5ApplicationIntegrationTest.java b/spring-5/src/test/java/com/baeldung/Spring5ApplicationIntegrationTest.java index af288c3c2d..1bbf0e3775 100644 --- a/spring-5/src/test/java/com/baeldung/Spring5ApplicationIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/Spring5ApplicationIntegrationTest.java @@ -1,5 +1,6 @@ package com.baeldung; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; @@ -7,6 +8,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest +@Ignore public class Spring5ApplicationIntegrationTest { @Test diff --git a/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationIntegrationTest.java b/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationIntegrationTest.java index 5392a59343..fba01726f4 100644 --- a/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/functional/BeanRegistrationIntegrationTest.java @@ -6,6 +6,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.context.support.GenericWebApplicationContext; @@ -13,6 +14,7 @@ import com.baeldung.Spring5Application; @RunWith(SpringRunner.class) @SpringBootTest(classes = Spring5Application.class) +@EnableJpaRepositories("com.baeldung.persistence") public class BeanRegistrationIntegrationTest { @Autowired diff --git a/spring-5/src/test/java/com/baeldung/jdbc/autogenkey/GetAutoGenKeyByJDBC.java b/spring-5/src/test/java/com/baeldung/jdbc/autogenkey/GetAutoGenKeyByJDBC.java index c52e18ef7f..45012a95aa 100644 --- a/spring-5/src/test/java/com/baeldung/jdbc/autogenkey/GetAutoGenKeyByJDBC.java +++ b/spring-5/src/test/java/com/baeldung/jdbc/autogenkey/GetAutoGenKeyByJDBC.java @@ -2,6 +2,7 @@ package com.baeldung.jdbc.autogenkey; import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -15,6 +16,7 @@ import com.baeldung.jdbc.autogenkey.repository.MessageRepositoryJDBCTemplate; import com.baeldung.jdbc.autogenkey.repository.MessageRepositorySimpleJDBCInsert; @RunWith(SpringRunner.class) +@Ignore public class GetAutoGenKeyByJDBC { @Configuration diff --git a/spring-5/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java b/spring-5/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java index 756b303f3b..f4749c0d33 100644 --- a/spring-5/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/jsonb/JsonbIntegrationTest.java @@ -5,6 +5,7 @@ import static org.junit.Assert.assertTrue; import java.math.BigDecimal; import java.time.LocalDate; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -16,18 +17,15 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(classes = Spring5Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@Ignore public class JsonbIntegrationTest { - @Value("${security.user.name}") - private String username; - @Value("${security.user.password}") - private String password; @Autowired private TestRestTemplate template; @Test public void givenId_whenUriIsPerson_thenGetPerson() { - ResponseEntity response = template.withBasicAuth(username, password) + ResponseEntity response = template .getForEntity("/person/1", Person.class); Person person = response.getBody(); assertTrue(person.equals(new Person(2, "Jhon", "jhon1@test.com", 0, LocalDate.of(2019, 9, 9), BigDecimal.valueOf(1500.0)))); @@ -35,8 +33,8 @@ public class JsonbIntegrationTest { @Test public void whenSendPostAPerson_thenGetOkStatus() { - ResponseEntity response = template.withBasicAuth(username, password) - .postForEntity("/person", "{\"birthDate\":\"07-09-2017\",\"email\":\"jhon1@test.com\",\"person-name\":\"Jhon\",\"id\":10}", Boolean.class); + ResponseEntity response = template.withBasicAuth("user","password"). + postForEntity("/person", "{\"birthDate\":\"07-09-2017\",\"email\":\"jhon1@test.com\",\"person-name\":\"Jhon\",\"id\":10}", Boolean.class); assertTrue(response.getBody()); } diff --git a/spring-5/src/test/java/com/baeldung/security/SecurityIntegrationTest.java b/spring-5/src/test/java/com/baeldung/security/SecurityIntegrationTest.java index 5680625496..1f8bb549c7 100644 --- a/spring-5/src/test/java/com/baeldung/security/SecurityIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/security/SecurityIntegrationTest.java @@ -2,6 +2,7 @@ package com.baeldung.security; import com.baeldung.SpringSecurity5Application; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -31,6 +32,7 @@ public class SecurityIntegrationTest { } @Test + @Ignore @WithMockUser public void whenHasCredentials_thenSeesGreeting() { this.rest.get().uri("/").exchange().expectStatus().isOk().expectBody(String.class).isEqualTo("Hello, user"); diff --git a/spring-5/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java b/spring-5/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java index 9a6e997ca1..f9472452ba 100644 --- a/spring-5/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/web/client/WebTestClientIntegrationTest.java @@ -5,6 +5,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.reactive.server.WebTestClient; import org.springframework.web.reactive.function.server.RequestPredicates; @@ -16,6 +17,7 @@ import reactor.core.publisher.Mono; @RunWith(SpringRunner.class) @SpringBootTest(classes = Spring5Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@EnableJpaRepositories("com.baeldung.persistence") public class WebTestClientIntegrationTest { @LocalServerPort diff --git a/spring-all/src/test/java/org/baeldung/controller/PassParametersControllerTest.java b/spring-all/src/test/java/org/baeldung/controller/PassParametersControllerIntegrationTest.java similarity index 97% rename from spring-all/src/test/java/org/baeldung/controller/PassParametersControllerTest.java rename to spring-all/src/test/java/org/baeldung/controller/PassParametersControllerIntegrationTest.java index 76ac14f292..21084f44ce 100644 --- a/spring-all/src/test/java/org/baeldung/controller/PassParametersControllerTest.java +++ b/spring-all/src/test/java/org/baeldung/controller/PassParametersControllerIntegrationTest.java @@ -23,7 +23,7 @@ import org.springframework.web.servlet.ModelAndView; @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration({"classpath:test-mvc.xml"}) -public class PassParametersControllerTest { +public class PassParametersControllerIntegrationTest { private MockMvc mockMvc; @Autowired diff --git a/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/ITransactionalTest.java b/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/ITransactionalUnitTest.java similarity index 80% rename from spring-all/src/test/java/org/baeldung/spring43/defaultmethods/ITransactionalTest.java rename to spring-all/src/test/java/org/baeldung/spring43/defaultmethods/ITransactionalUnitTest.java index c7b95bced4..3c180e91c8 100644 --- a/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/ITransactionalTest.java +++ b/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/ITransactionalUnitTest.java @@ -5,9 +5,9 @@ import org.slf4j.LoggerFactory; import org.springframework.test.context.transaction.AfterTransaction; import org.springframework.test.context.transaction.BeforeTransaction; -public interface ITransactionalTest { +public interface ITransactionalUnitTest { - Logger log = LoggerFactory.getLogger(ITransactionalTest.class); + Logger log = LoggerFactory.getLogger(ITransactionalUnitTest.class); @BeforeTransaction default void beforeTransaction() { diff --git a/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalIntegrationTest.java b/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalIntegrationTest.java index b4ac7e8ccf..dde153487d 100644 --- a/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalIntegrationTest.java +++ b/spring-all/src/test/java/org/baeldung/spring43/defaultmethods/TransactionalIntegrationTest.java @@ -5,7 +5,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; @ContextConfiguration(classes = TransactionalTestConfiguration.class) -public class TransactionalIntegrationTest extends AbstractTransactionalJUnit4SpringContextTests implements ITransactionalTest { +public class TransactionalIntegrationTest extends AbstractTransactionalJUnit4SpringContextTests implements ITransactionalUnitTest { @Test public void whenDefaultMethodAnnotatedWithBeforeTransaction_thenDefaultMethodIsExecuted() { diff --git a/spring-boot-ops/README.MD b/spring-boot-ops/README.MD deleted file mode 100644 index 5ac223397c..0000000000 --- a/spring-boot-ops/README.MD +++ /dev/null @@ -1,13 +0,0 @@ -### The Course -The "REST With Spring" Classes: http://bit.ly/restwithspring - -### Relevant Articles: - -- [Intro to Spring Boot Starters](http://www.baeldung.com/spring-boot-starters) -- [A Custom Data Binder in Spring MVC](http://www.baeldung.com/spring-mvc-custom-data-binder) -- [Introduction to WebJars](http://www.baeldung.com/maven-webjars) -- [A Quick Guide to Maven Wrapper](http://www.baeldung.com/maven-wrapper) -- [Shutdown a Spring Boot Application](http://www.baeldung.com/spring-boot-shutdown) -- [Create a Fat Jar App with Spring Boot](http://www.baeldung.com/deployable-fat-jar-spring-boot) -- [Spring Boot Dependency Management with a Custom Parent](http://www.baeldung.com/spring-boot-dependency-management-custom-parent) - diff --git a/spring-boot-ops/README.md b/spring-boot-ops/README.md deleted file mode 100644 index 7de2fed24f..0000000000 --- a/spring-boot-ops/README.md +++ /dev/null @@ -1,12 +0,0 @@ -### The Course -The "REST With Spring" Classes: http://bit.ly/restwithspring - -### Relevant Articles: - -- [Intro to Spring Boot Starters](http://www.baeldung.com/spring-boot-starters) -- [A Custom Data Binder in Spring MVC](http://www.baeldung.com/spring-mvc-custom-data-binder) -- [Introduction to WebJars](http://www.baeldung.com/maven-webjars) -- [A Quick Guide to Maven Wrapper](http://www.baeldung.com/maven-wrapper) -- [Shutdown a Spring Boot Application](http://www.baeldung.com/spring-boot-shutdown) -- [Create a Fat Jar App with Spring Boot](http://www.baeldung.com/deployable-fat-jar-spring-boot) -- [Spring Boot Dependency Management with a Custom Parent](http://www.baeldung.com/spring-boot-dependency-management-custom-parent) \ No newline at end of file diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationTests.java b/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationIntegrationTest.java similarity index 84% rename from spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationTests.java rename to spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationIntegrationTest.java index 5ccc49eaa7..2440b97aaf 100644 --- a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationTests.java +++ b/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationIntegrationTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class KubernetesBackendApplicationTests { +public class KubernetesBackendApplicationIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationTests.java b/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationIntegrationTest.java similarity index 84% rename from spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationTests.java rename to spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationIntegrationTest.java index 0e34eb45f8..19ad9676cb 100644 --- a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationTests.java +++ b/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationIntegrationTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class KubernetesFrontendApplicationTests { +public class KubernetesFrontendApplicationIntegrationTest { @Test public void contextLoads() { diff --git a/spring-data-rest/src/test/java/com/baeldung/events/AuthorEventHandlerTest.java b/spring-data-rest/src/test/java/com/baeldung/events/AuthorEventHandlerUnitTest.java similarity index 95% rename from spring-data-rest/src/test/java/com/baeldung/events/AuthorEventHandlerTest.java rename to spring-data-rest/src/test/java/com/baeldung/events/AuthorEventHandlerUnitTest.java index 9fb2d1014e..6db536c40c 100644 --- a/spring-data-rest/src/test/java/com/baeldung/events/AuthorEventHandlerTest.java +++ b/spring-data-rest/src/test/java/com/baeldung/events/AuthorEventHandlerUnitTest.java @@ -7,7 +7,7 @@ import org.springframework.data.rest.core.annotation.RepositoryEventHandler; import static org.mockito.Mockito.mock; -public class AuthorEventHandlerTest { +public class AuthorEventHandlerUnitTest { @Test public void whenCreateAuthorThenSuccess() { diff --git a/spring-data-rest/src/test/java/com/baeldung/events/BookEventHandlerTest.java b/spring-data-rest/src/test/java/com/baeldung/events/BookEventHandlerUnitTest.java similarity index 95% rename from spring-data-rest/src/test/java/com/baeldung/events/BookEventHandlerTest.java rename to spring-data-rest/src/test/java/com/baeldung/events/BookEventHandlerUnitTest.java index 85699adb0d..28f0b91e1c 100644 --- a/spring-data-rest/src/test/java/com/baeldung/events/BookEventHandlerTest.java +++ b/spring-data-rest/src/test/java/com/baeldung/events/BookEventHandlerUnitTest.java @@ -7,7 +7,7 @@ import org.mockito.Mockito; import static org.mockito.Mockito.mock; -public class BookEventHandlerTest { +public class BookEventHandlerUnitTest { @Test public void whenCreateBookThenSuccess() { Book book = mock(Book.class); diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/SimpleBookControllerTest.java b/spring-mvc-java/src/test/java/com/baeldung/web/controller/SimpleBookControllerIntegrationTest.java similarity index 95% rename from spring-mvc-java/src/test/java/com/baeldung/web/controller/SimpleBookControllerTest.java rename to spring-mvc-java/src/test/java/com/baeldung/web/controller/SimpleBookControllerIntegrationTest.java index 4be0ded963..23be3a1655 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/web/controller/SimpleBookControllerTest.java +++ b/spring-mvc-java/src/test/java/com/baeldung/web/controller/SimpleBookControllerIntegrationTest.java @@ -12,7 +12,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import com.baeldung.web.controller.SimpleBookController; -public class SimpleBookControllerTest { +public class SimpleBookControllerIntegrationTest { private MockMvc mockMvc; private static final String CONTENT_TYPE = "application/json;charset=UTF-8"; diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/SimpleBookRestControllerTest.java b/spring-mvc-java/src/test/java/com/baeldung/web/controller/SimpleBookRestControllerIntegrationTest.java similarity index 95% rename from spring-mvc-java/src/test/java/com/baeldung/web/controller/SimpleBookRestControllerTest.java rename to spring-mvc-java/src/test/java/com/baeldung/web/controller/SimpleBookRestControllerIntegrationTest.java index 23b8c639d3..c5bd53f1a7 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/web/controller/SimpleBookRestControllerTest.java +++ b/spring-mvc-java/src/test/java/com/baeldung/web/controller/SimpleBookRestControllerIntegrationTest.java @@ -12,7 +12,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import com.baeldung.web.controller.SimpleBookController; -public class SimpleBookRestControllerTest { +public class SimpleBookRestControllerIntegrationTest { private MockMvc mockMvc; private static final String CONTENT_TYPE = "application/json;charset=UTF-8"; diff --git a/spring-rest-full/src/test/java/org/baeldung/spring/ConfigTest.java b/spring-rest-full/src/test/java/org/baeldung/spring/ConfigIntegrationTest.java similarity index 75% rename from spring-rest-full/src/test/java/org/baeldung/spring/ConfigTest.java rename to spring-rest-full/src/test/java/org/baeldung/spring/ConfigIntegrationTest.java index 56f3de6cb0..77603da0dd 100644 --- a/spring-rest-full/src/test/java/org/baeldung/spring/ConfigTest.java +++ b/spring-rest-full/src/test/java/org/baeldung/spring/ConfigIntegrationTest.java @@ -6,9 +6,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @ComponentScan("org.baeldung.test") -public class ConfigTest extends WebMvcConfigurerAdapter { +public class ConfigIntegrationTest extends WebMvcConfigurerAdapter { - public ConfigTest() { + public ConfigIntegrationTest() { super(); } diff --git a/spring-rest-full/src/test/java/org/baeldung/web/FooDiscoverabilityLiveTest.java b/spring-rest-full/src/test/java/org/baeldung/web/FooDiscoverabilityLiveTest.java index c0e1f9d04d..a6577e4de8 100644 --- a/spring-rest-full/src/test/java/org/baeldung/web/FooDiscoverabilityLiveTest.java +++ b/spring-rest-full/src/test/java/org/baeldung/web/FooDiscoverabilityLiveTest.java @@ -4,7 +4,7 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import org.baeldung.common.web.AbstractDiscoverabilityLiveTest; import org.baeldung.persistence.model.Foo; -import org.baeldung.spring.ConfigTest; +import org.baeldung.spring.ConfigIntegrationTest; import org.junit.runner.RunWith; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; @@ -12,7 +12,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { ConfigTest.class }, loader = AnnotationConfigContextLoader.class) +@ContextConfiguration(classes = { ConfigIntegrationTest.class }, loader = AnnotationConfigContextLoader.class) @ActiveProfiles("test") public class FooDiscoverabilityLiveTest extends AbstractDiscoverabilityLiveTest { diff --git a/spring-rest-full/src/test/java/org/baeldung/web/FooLiveTest.java b/spring-rest-full/src/test/java/org/baeldung/web/FooLiveTest.java index 5a4f472fe3..65564a6845 100644 --- a/spring-rest-full/src/test/java/org/baeldung/web/FooLiveTest.java +++ b/spring-rest-full/src/test/java/org/baeldung/web/FooLiveTest.java @@ -4,7 +4,7 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import org.baeldung.common.web.AbstractBasicLiveTest; import org.baeldung.persistence.model.Foo; -import org.baeldung.spring.ConfigTest; +import org.baeldung.spring.ConfigIntegrationTest; import org.junit.runner.RunWith; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; @@ -12,7 +12,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { ConfigTest.class }, loader = AnnotationConfigContextLoader.class) +@ContextConfiguration(classes = { ConfigIntegrationTest.class }, loader = AnnotationConfigContextLoader.class) @ActiveProfiles("test") public class FooLiveTest extends AbstractBasicLiveTest { diff --git a/spring-rest-full/src/test/java/org/baeldung/web/FooPageableLiveTest.java b/spring-rest-full/src/test/java/org/baeldung/web/FooPageableLiveTest.java index 62a8983356..3f637c5213 100644 --- a/spring-rest-full/src/test/java/org/baeldung/web/FooPageableLiveTest.java +++ b/spring-rest-full/src/test/java/org/baeldung/web/FooPageableLiveTest.java @@ -13,7 +13,7 @@ import java.util.List; import org.baeldung.common.web.AbstractBasicLiveTest; import org.baeldung.persistence.model.Foo; -import org.baeldung.spring.ConfigTest; +import org.baeldung.spring.ConfigIntegrationTest; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ActiveProfiles; @@ -22,7 +22,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { ConfigTest.class }, loader = AnnotationConfigContextLoader.class) +@ContextConfiguration(classes = { ConfigIntegrationTest.class }, loader = AnnotationConfigContextLoader.class) @ActiveProfiles("test") public class FooPageableLiveTest extends AbstractBasicLiveTest { diff --git a/spring-rest/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorTest.java b/spring-rest/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorUnitTest.java similarity index 97% rename from spring-rest/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorTest.java rename to spring-rest/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorUnitTest.java index e87adbc712..a84f866dfe 100644 --- a/spring-rest/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorTest.java +++ b/spring-rest/src/test/java/com/baeldung/propertyeditor/creditcard/CreditCardEditorUnitTest.java @@ -10,7 +10,7 @@ import com.baeldung.propertyeditor.creditcard.CreditCard; import com.baeldung.propertyeditor.creditcard.CreditCardEditor; @RunWith(MockitoJUnitRunner.class) -public class CreditCardEditorTest { +public class CreditCardEditorUnitTest { private CreditCardEditor creditCardEditor; diff --git a/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationTests.java b/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationIntegrationTest.java similarity index 90% rename from spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationTests.java rename to spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationIntegrationTest.java index dea254dd31..c852d05e73 100644 --- a/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationTests.java +++ b/spring-security-thymeleaf/src/test/java/com/baeldung/springsecuritythymeleaf/SpringSecurityThymeleafApplicationIntegrationTest.java @@ -11,7 +11,7 @@ import org.springframework.web.context.WebApplicationContext; @RunWith(SpringRunner.class) @SpringBootTest -public class SpringSecurityThymeleafApplicationTests { +public class SpringSecurityThymeleafApplicationIntegrationTest { @Autowired ViewController viewController; diff --git a/vavr/src/test/java/com/baeldung/vavr/future/FutureTest.java b/vavr/src/test/java/com/baeldung/vavr/future/FutureUnitTest.java similarity index 99% rename from vavr/src/test/java/com/baeldung/vavr/future/FutureTest.java rename to vavr/src/test/java/com/baeldung/vavr/future/FutureUnitTest.java index d5345cad55..c398cc4095 100644 --- a/vavr/src/test/java/com/baeldung/vavr/future/FutureTest.java +++ b/vavr/src/test/java/com/baeldung/vavr/future/FutureUnitTest.java @@ -13,7 +13,7 @@ import static java.util.concurrent.Executors.newSingleThreadExecutor; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -public class FutureTest { +public class FutureUnitTest { private static final String error = "Failed to get underlying value."; private static final String HELLO = "Welcome to Baeldung!";