From 466cc33e83d6ef2c0e0db460d1eafda498ed3cdf Mon Sep 17 00:00:00 2001 From: panos-kakos Date: Thu, 13 Mar 2025 11:52:27 +0200 Subject: [PATCH] [JAVA-42436] --- apache-httpclient-2/pom.xml | 10 +++++ apache-httpclient/pom.xml | 12 +++++- .../src/test/resources/mockserver.properties | 1 + .../core-java-date-operations/pom.xml | 2 +- .../node/JsonNodeIteratorUnitTest.java | 19 ++++----- .../src/main/resources/hibernate.cfg.xml | 2 +- .../controller/GreetControllerUnitTest.java | 39 ++++++++++++++----- 7 files changed, 62 insertions(+), 23 deletions(-) create mode 100644 apache-httpclient4/src/test/resources/mockserver.properties diff --git a/apache-httpclient-2/pom.xml b/apache-httpclient-2/pom.xml index bd9f26a42d38..77cc5615dc17 100644 --- a/apache-httpclient-2/pom.xml +++ b/apache-httpclient-2/pom.xml @@ -66,6 +66,16 @@ 11 + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + OFF + + + diff --git a/apache-httpclient/pom.xml b/apache-httpclient/pom.xml index 445cf14ca46a..4fcf47743527 100644 --- a/apache-httpclient/pom.xml +++ b/apache-httpclient/pom.xml @@ -82,6 +82,16 @@ 11 + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + OFF + + + @@ -92,7 +102,7 @@ - 5.6.1 + 5.11.2 3.9.1 5.2.5 diff --git a/apache-httpclient4/src/test/resources/mockserver.properties b/apache-httpclient4/src/test/resources/mockserver.properties new file mode 100644 index 000000000000..23dc75415cbc --- /dev/null +++ b/apache-httpclient4/src/test/resources/mockserver.properties @@ -0,0 +1 @@ +mockserver.logLevel=OFF \ No newline at end of file diff --git a/core-java-modules/core-java-date-operations/pom.xml b/core-java-modules/core-java-date-operations/pom.xml index 6a358c31df10..b38f31a3229e 100644 --- a/core-java-modules/core-java-date-operations/pom.xml +++ b/core-java-modules/core-java-date-operations/pom.xml @@ -33,7 +33,7 @@ - core-java-date-operations-1 + core-java-date-operations src/main/resources diff --git a/jackson-modules/jackson-core/src/test/java/com/baeldung/jackson/node/JsonNodeIteratorUnitTest.java b/jackson-modules/jackson-core/src/test/java/com/baeldung/jackson/node/JsonNodeIteratorUnitTest.java index 05426fc844b0..c3da44fe3af7 100644 --- a/jackson-modules/jackson-core/src/test/java/com/baeldung/jackson/node/JsonNodeIteratorUnitTest.java +++ b/jackson-modules/jackson-core/src/test/java/com/baeldung/jackson/node/JsonNodeIteratorUnitTest.java @@ -21,17 +21,14 @@ public class JsonNodeIteratorUnitTest { " number: 1\n" + "- type: fish\n" + " number: 50"; - -@Test -public void givenANodeTree_whenIteratingSubNodes_thenWeFindExpected() throws IOException { - final JsonNode rootNode = ExampleStructure.getExampleRoot(); - - String yaml = onTest.toYaml(rootNode); - System.out.println(yaml.toString()); - - assertEquals(expectedYaml, yaml); - -} + @Test + public void givenANodeTree_whenIteratingSubNodes_thenWeFindExpected() throws IOException { + final JsonNode rootNode = ExampleStructure.getExampleRoot(); + + String yaml = onTest.toYaml(rootNode); + + assertEquals(expectedYaml, yaml); + } } diff --git a/persistence-modules/hibernate-queries/src/main/resources/hibernate.cfg.xml b/persistence-modules/hibernate-queries/src/main/resources/hibernate.cfg.xml index 7681d35dfa98..e4d4b04fb023 100644 --- a/persistence-modules/hibernate-queries/src/main/resources/hibernate.cfg.xml +++ b/persistence-modules/hibernate-queries/src/main/resources/hibernate.cfg.xml @@ -10,7 +10,7 @@ sa org.hibernate.dialect.H2Dialect - true + false true create-drop thread diff --git a/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerUnitTest.java b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerUnitTest.java index ecc55e8da2ba..19f1de2e056c 100644 --- a/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerUnitTest.java +++ b/spring-web-modules/spring-mvc-java/src/test/java/com/baeldung/web/controller/GreetControllerUnitTest.java @@ -17,42 +17,63 @@ public class GreetControllerUnitTest { @BeforeEach void setUp() { - this.mockMvc = MockMvcBuilders.standaloneSetup(new GreetController()).build(); + this.mockMvc = MockMvcBuilders.standaloneSetup(new GreetController()) + .build(); } @Test public void givenHomePageURI_whenMockMVC_thenReturnsIndexJSPViewName() throws Exception { - this.mockMvc.perform(get("/homePage")).andExpect(view().name("index")); + this.mockMvc.perform(get("/homePage")) + .andExpect(view().name("index")); } @Test public void givenGreetURI_whenMockMVC_thenVerifyResponse() throws Exception { - this.mockMvc.perform(get("/greet")).andExpect(status().isOk()).andExpect(content().contentType(CONTENT_TYPE)).andExpect(jsonPath("$.message").value("Hello World!!!")); + this.mockMvc.perform(get("/greet")) + .andExpect(status().isOk()) + .andExpect(content().contentType(CONTENT_TYPE)) + .andExpect(jsonPath("$.message").value("Hello World!!!")); } @Test public void givenGreetURIWithPathVariable_whenMockMVC_thenVerifyResponse() throws Exception { - this.mockMvc.perform(get("/greetWithPathVariable/John")).andExpect(status().isOk()).andExpect(content().contentType(CONTENT_TYPE)).andExpect(jsonPath("$.message").value("Hello World John!!!")); + this.mockMvc.perform(get("/greetWithPathVariable/John")) + .andExpect(status().isOk()) + .andExpect(content().contentType(CONTENT_TYPE)) + .andExpect(jsonPath("$.message").value("Hello World John!!!")); } @Test public void givenGreetURIWithPathVariable_2_whenMockMVC_thenVerifyResponse() throws Exception { - this.mockMvc.perform(get("/greetWithPathVariable/{name}", "Doe")).andExpect(status().isOk()).andExpect(content().contentType(CONTENT_TYPE)).andExpect(jsonPath("$.message").value("Hello World Doe!!!")); + this.mockMvc.perform(get("/greetWithPathVariable/{name}", "Doe")) + .andExpect(status().isOk()) + .andExpect(content().contentType(CONTENT_TYPE)) + .andExpect(jsonPath("$.message").value("Hello World Doe!!!")); } @Test public void givenGreetURIWithQueryParameter_whenMockMVC_thenVerifyResponse() throws Exception { - this.mockMvc.perform(get("/greetWithQueryVariable").param("name", "John Doe")).andDo(print()).andExpect(status().isOk()).andExpect(content().contentType(CONTENT_TYPE)).andExpect(jsonPath("$.message").value("Hello World John Doe!!!")); + this.mockMvc.perform(get("/greetWithQueryVariable").param("name", "John Doe")) + .andExpect(status().isOk()) + .andExpect(content().contentType(CONTENT_TYPE)) + .andExpect(jsonPath("$.message").value("Hello World John Doe!!!")); } @Test public void givenGreetURIWithPost_whenMockMVC_thenVerifyResponse() throws Exception { - this.mockMvc.perform(post("/greetWithPost")).andDo(print()).andExpect(status().isOk()).andExpect(content().contentType(CONTENT_TYPE)).andExpect(jsonPath("$.message").value("Hello World!!!")); + this.mockMvc.perform(post("/greetWithPost")) + .andExpect(status().isOk()) + .andExpect(content().contentType(CONTENT_TYPE)) + .andExpect(jsonPath("$.message").value("Hello World!!!")); } @Test public void givenGreetURIWithPostAndFormData_whenMockMVC_thenVerifyResponse() throws Exception { - this.mockMvc.perform(post("/greetWithPostAndFormData").param("id", "1").param("name", "John Doe")).andDo(print()).andExpect(status().isOk()).andExpect(content().contentType(CONTENT_TYPE)) - .andExpect(jsonPath("$.message").value("Hello World John Doe!!!")).andExpect(jsonPath("$.id").value(1)); + this.mockMvc.perform(post("/greetWithPostAndFormData").param("id", "1") + .param("name", "John Doe")) + .andExpect(status().isOk()) + .andExpect(content().contentType(CONTENT_TYPE)) + .andExpect(jsonPath("$.message").value("Hello World John Doe!!!")) + .andExpect(jsonPath("$.id").value(1)); } }