JAVA-32410: Update mockito-core to version 5.11.0 (#16199)

* JAVA-32410: Update mockito-core to version 5.11.0

* Fix rollback mockito upgrade.

* wip

* WIP: Update jee-7 wildfly versions

* WIP: Fix jersey tests

* WIP: rollback powermock module

* wip: fix test in spring-data-dynamodb

* wip: fix test in spring-security-legacy-oidc

* wip: rollback quarkus

* wip: fix greeter-spring-boot-autoconfigure

* JAVA-33535: Fix spring-core module integration test

JAVA-33535: rollback junit-5 module mockito version.

* Fix byte-buddy

* Fix log4j dependency in apache-poi
This commit is contained in:
Harry9656 2024-04-11 01:26:19 +02:00 committed by GitHub
parent f1af9d5e55
commit 4394e828c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 106 additions and 84 deletions

View File

@ -40,6 +40,16 @@
<artifactId>fastexcel-reader</artifactId>
<version>${fastexcel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>
<build>
@ -64,6 +74,7 @@
<jexcel.version>1.0.9</jexcel.version>
<fastexcel.version>0.17.0</fastexcel.version>
<maven.resources.plugin.version>3.3.1</maven.resources.plugin.version>
<log4j.version>2.23.1</log4j.version>
</properties>
</project>

View File

@ -71,7 +71,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito-core.version}</version>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@ -112,7 +112,6 @@
<feign-core.version>11.2</feign-core.version>
<guice.version>5.1.0</guice.version>
<system-stubs-junit4.version>2.0.2</system-stubs-junit4.version>
<mockito-core.version>4.1.0</mockito-core.version>
<assertj-core.version>3.19.0</assertj-core.version>
<junit-jupiter.version>5.8.1</junit-jupiter.version>
</properties>

View File

@ -260,7 +260,6 @@
<!-- util -->
<unix4j.version>0.4</unix4j.version>
<grep4j.version>1.8.7</grep4j.version>
<mockito.version>4.6.1</mockito.version>
<!-- maven plugins -->
<javamoney.moneta.version>1.1</javamoney.moneta.version>
<maven-javadoc-plugin.version>3.6.2</maven-javadoc-plugin.version>

View File

@ -20,7 +20,7 @@
<!-- Boot version compatible with spqr-boot-starter -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.6.4</version>
<version>2.6.15</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -34,4 +34,9 @@
<module>graphql-spqr-boot-starter</module>
</modules>
<properties>
<!-- Can't update to the recent mockito version, without updating the spring boot version-->
<mockito.version>4.4.0</mockito.version>
</properties>
</project>

View File

@ -85,7 +85,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${mockito.version}</version>
<version>${mockito-inline.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@ -120,6 +120,7 @@
<reactive.stream.version>1.0.3</reactive.stream.version>
<reactor.version>3.6.0</reactor.version>
<jmockit.version>1.49</jmockit.version>
<mockito-inline.version>5.2.0</mockito-inline.version>
</properties>
</project>

View File

@ -44,7 +44,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito-core.version}</version>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@ -83,7 +83,6 @@
<activemq.version>5.14.1</activemq.version>
<spring-boot-test.version>1.5.10.RELEASE</spring-boot-test.version>
<maven-war-plugin.version>3.3.2</maven-war-plugin.version>
<mockito-core.version>4.6.1</mockito-core.version>
<activemq-junit.version>5.16.5</activemq-junit.version>
<testcontainers.version>1.17.3</testcontainers.version>
<junit-jupiter.version>5.10.1</junit-jupiter.version>

View File

@ -16,9 +16,13 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${mockito.version}</version>
<version>${mockito-inline.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<mockito-inline.version>5.2.0</mockito-inline.version>
</properties>
</project>

View File

@ -70,7 +70,6 @@
</dependencies>
<properties>
<mockito.version>2.23.0</mockito.version>
<validation-api.version>2.0.1.Final</validation-api.version>
<mysql-connector-java.version>8.2.0</mysql-connector-java.version>
<start-class>com.baeldung.boot.Application</start-class>

View File

@ -136,6 +136,12 @@
<type>so</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.13</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -5,8 +5,6 @@ import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.baeldung.Application;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
public class SpringContextTest {

View File

@ -1149,7 +1149,7 @@
<assertj.version>3.21.0</assertj.version>
<hamcrest.version>2.2</hamcrest.version>
<hamcrest-all.version>1.3</hamcrest-all.version>
<mockito.version>4.4.0</mockito.version>
<mockito.version>5.11.0</mockito.version>
<byte-buddy.version>1.14.11</byte-buddy.version>
<!-- logging -->

View File

@ -37,7 +37,6 @@
<surefire-plugin.version>3.0.0</surefire-plugin.version>
<loom-unit.version>0.3.0</loom-unit.version>
<panache-common-deployment.version>3.6.0</panache-common-deployment.version>
<mockito-core.version>3.11.2</mockito-core.version>
</properties>
<dependencies>
@ -92,7 +91,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito-core.version}</version>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -180,7 +180,7 @@
<properties>
<quarkus.version>2.16.3.Final</quarkus.version>
<mockito.version>3.3.0</mockito.version>
<mockito.version>4.4.0</mockito.version> <!-- Current quarkus doesn't support latest version. If Upgrading to a new quarkus remove this. -->
</properties>
</project>

View File

@ -45,6 +45,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -42,6 +42,12 @@
<version>${spring-boot.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>${byte-buddy.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@ -61,6 +67,7 @@
<properties>
<spring-boot.version>2.2.6.RELEASE</spring-boot.version>
<greeter.version>0.0.1-SNAPSHOT</greeter.version>
<byte-buddy.version>1.14.13</byte-buddy.version>
</properties>
</project>

View File

@ -49,7 +49,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
<version>${mockito.spring.boot.version}</version>
<version>${spring-boot.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@ -78,10 +78,8 @@
</build>
<properties>
<mockito.spring.boot.version>1.4.4.RELEASE</mockito.spring.boot.version>
<javax.inject.version>1</javax.inject.version>
<spring-boot.version>1.5.2.RELEASE</spring-boot.version>
<mockito.version>1.10.19</mockito.version>
<annotation-api.version>1.3.2</annotation-api.version>
</properties>

View File

@ -189,7 +189,6 @@
<springframework.version>5.2.3.RELEASE</springframework.version>
<activemq-broker.version>5.16.3</activemq-broker.version>
<activemq-junit.version>5.16.3</activemq-junit.version>
<mockito.version>2.21.0</mockito.version>
<maven-dependency-plugin.version>2.8</maven-dependency-plugin.version>
<wildfly-ejb.version>8.2.1.Final</wildfly-ejb.version>
<joda-time.version>2.12.5</joda-time.version>

View File

@ -42,6 +42,12 @@
<artifactId>jwks-rsa</artifactId>
<version>${jwks-rsa.version}</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.13</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>

View File

@ -77,7 +77,6 @@
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<junit.jupiter.engine.version>5.9.3</junit.jupiter.engine.version>
<mockito.version>5.3.1</mockito.version>
<thymeleaf.spring6.version>3.1.1.RELEASE</thymeleaf.spring6.version>
<spring.boot.starter.thymeleaf>3.1.1</spring.boot.starter.thymeleaf>
</properties>

View File

@ -26,7 +26,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito-core.version}</version>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@ -42,7 +42,6 @@
<properties>
<junit-jupiter-api.version>5.10.0</junit-jupiter-api.version>
<mockito-core.version>5.5.0</mockito-core.version>
</properties>
</project>

View File

@ -89,11 +89,6 @@
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@ -135,7 +130,7 @@
<log4j2.version>2.17.1</log4j2.version>
<powermock.version>2.0.9</powermock.version>
<spring.version>5.0.1.RELEASE</spring.version>
<mockito.version>3.3.0</mockito.version>
<mockito.version>3.3.0</mockito.version> <!-- Cannot Upgrade to recent versions. Powermock doesn't support it -->
</properties>
</project>

View File

@ -34,8 +34,8 @@
<properties>
<mockito-inline.version>4.8.1</mockito-inline.version>
<mockito.version>5.10.0</mockito.version>
<lombok.version>1.18.30</lombok.version>
</properties>
</project>

View File

@ -60,7 +60,6 @@
<properties>
<spring-framework.version>6.0.8</spring-framework.version>
<mockito.version>5.3.1</mockito.version>
</properties>
</project>

View File

@ -41,7 +41,7 @@
</build>
<properties>
<mockito.version>2.21.0</mockito.version>
<mockito.version>2.21.0</mockito.version> <!--Cannot upgrade to the latest version as powermock doesn't support that-->
<powermock.version>2.0.9</powermock.version>
</properties>

View File

@ -48,7 +48,7 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
@ -100,11 +100,10 @@
<jakartaee-api.version>9.0.0</jakartaee-api.version>
<krazo.version>2.0.0</krazo.version>
<jakarta.mvc-api.version>2.0.0</jakarta.mvc-api.version>
<junit.jupiter.version>5.8.2</junit.jupiter.version>
<junit.jupiter.version>5.10.2</junit.jupiter.version>
<local.glassfish.home>C:/glassfish6</local.glassfish.home>
<local.glassfish.user>admin</local.glassfish.user>
<local.glassfish.domain>mvn-domain</local.glassfish.domain>
<mockito.version>1.10.19</mockito.version>
<local.glassfish.passfile>
${local.glassfish.home}\\domains\\${local.glassfish.domain}\\config\\domain-passwords
</local.glassfish.passfile>

View File

@ -1,25 +1,23 @@
package com.baeldung.eclipse.krazo;
import com.baeldung.eclipse.krazo.User;
import com.baeldung.eclipse.krazo.UserController;
import jakarta.mvc.Models;
import jakarta.mvc.binding.BindingResult;
import org.eclipse.krazo.core.ModelsImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.when;
import org.eclipse.krazo.core.ModelsImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import jakarta.mvc.Models;
import jakarta.mvc.binding.BindingResult;
/**
* The class contains unit tests. We do only unit tests. Most of the classes are mocked
*/

View File

@ -112,7 +112,6 @@
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
<jetty-maven-plugin.version>10.0.4</jetty-maven-plugin.version>
<commons-text.version>1.10.0</commons-text.version>
<mockito.version>5.6.0</mockito.version>
<uap.version>1.5.4</uap.version>
</properties>

View File

@ -312,7 +312,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<version>${wildfly.version}</version>
<scope>test</scope>
@ -345,7 +345,7 @@
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>${wildfly.version}</version>
<version>${wildfly-dist.version}</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
@ -395,7 +395,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>${wildfly.version}</version>
<scope>test</scope>
@ -520,7 +520,8 @@
<maven.min.version>3.0.0</maven.min.version>
<javaee_api.version>7.0</javaee_api.version>
<arquillian_core.version>1.1.11.Final</arquillian_core.version>
<wildfly.version>8.2.1.Final</wildfly.version>
<wildfly-dist.version>31.0.1.Final</wildfly-dist.version>
<wildfly.version>5.0.1.Final</wildfly.version>
<awaitility.version>1.7.0</awaitility.version>
<undertow-websockets-jsr.version>1.4.6.Final</undertow-websockets-jsr.version>
<resteasy.version>3.0.19.Final</resteasy.version>

View File

@ -5,6 +5,7 @@ import com.baeldung.jersey.server.config.HelloBinding;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.Response;
@Path("/greetings")
@ -17,6 +18,7 @@ public class Greetings {
}
@GET
@Produces("text/html")
@Path("/hi")
public String getHiGreeting() {
return "hi";

View File

@ -1,18 +1,18 @@
package com.baeldung.jersey.server;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import jakarta.ws.rs.core.Application;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
public class GreetingsResourceIntegrationTest extends JerseyTest {
class GreetingsResourceIntegrationTest extends JerseyTest {
@Override
protected Application configure() {
@ -21,14 +21,14 @@ public class GreetingsResourceIntegrationTest extends JerseyTest {
}
@Test
public void givenGetHiGreeting_whenCorrectRequest_thenResponseIsOkAndContainsHi() {
void givenGetHiGreeting_whenCorrectRequest_thenResponseIsOkAndContainsHi() {
Response response = target("/greetings/hi").request()
.get();
assertEquals("Http Response should be 200: ", Response.Status.OK.getStatusCode(), response.getStatus());
assertEquals("Http Content-Type should be: ", MediaType.TEXT_HTML, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
assertEquals(MediaType.TEXT_HTML, response.getHeaderString(HttpHeaders.CONTENT_TYPE));
String content = response.readEntity(String.class);
assertEquals("Content of ressponse is: ", "hi", content);
assertEquals("hi", content);
}
}

View File

@ -2,12 +2,12 @@ package com.baeldung.jersey.server.rest;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import com.baeldung.jersey.server.config.ViewApplicationConfig;
import com.baeldung.jersey.server.model.Fruit;
@ -19,7 +19,7 @@ import jakarta.ws.rs.core.Form;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
public class FruitResourceIntegrationTest extends JerseyTest {
class FruitResourceIntegrationTest extends JerseyTest {
@Override
protected Application configure() {
@ -33,80 +33,80 @@ public class FruitResourceIntegrationTest extends JerseyTest {
}
@Test
public void givenGetAllFruit_whenCorrectRequest_thenAllTemplateInvoked() {
void givenGetAllFruit_whenCorrectRequest_thenAllTemplateInvoked() {
final String response = target("/fruit/all").request()
.get(String.class);
assertThat(response, allOf(containsString("banana"), containsString("apple"), containsString("kiwi")));
}
@Test
public void givenGetFruit_whenCorrectRequest_thenIndexTemplateInvoked() {
void givenGetFruit_whenCorrectRequest_thenIndexTemplateInvoked() {
final String response = target("/fruit").request()
.get(String.class);
assertThat(response, containsString("Welcome Fruit Index Page!"));
}
@Test
public void givenGetFruitByName_whenFruitUnknown_thenErrorTemplateInvoked() {
void givenGetFruitByName_whenFruitUnknown_thenErrorTemplateInvoked() {
final String response = target("/fruit/orange").request()
.get(String.class);
assertThat(response, containsString("Error - Fruit not found: orange!"));
}
@Test
public void givenCreateFruit_whenFormContainsNullParam_thenResponseCodeIsBadRequest() {
void givenCreateFruit_whenFormContainsNullParam_thenResponseCodeIsBadRequest() {
Form form = new Form();
form.param("name", "apple");
form.param("colour", null);
Response response = target("fruit/create").request(MediaType.APPLICATION_FORM_URLENCODED)
.post(Entity.form(form));
assertEquals("Http Response should be 400 ", 400, response.getStatus());
assertEquals(400, response.getStatus());
assertThat(response.readEntity(String.class), containsString("Fruit colour must not be null"));
}
@Test
public void givenCreateFruit_whenJsonIsCorrect_thenResponseCodeIsCreated() {
void givenCreateFruit_whenJsonIsCorrect_thenResponseCodeIsCreated() {
Response response = target("fruit/created").request()
.post(Entity.json("{\"name\":\"strawberry\",\"weight\":20}"));
assertEquals("Http Response should be 201 ", Response.Status.CREATED.getStatusCode(), response.getStatus());
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
assertThat(response.readEntity(String.class), containsString("Fruit saved : Fruit [name: strawberry colour: null]"));
}
@Test
public void givenUpdateFruit_whenFormContainsBadSerialParam_thenResponseCodeIsBadRequest() {
void givenUpdateFruit_whenFormContainsBadSerialParam_thenResponseCodeIsBadRequest() {
Form form = new Form();
form.param("serial", "2345-2345");
Response response = target("fruit/update").request(MediaType.APPLICATION_FORM_URLENCODED)
.put(Entity.form(form));
assertEquals("Http Response should be 400 ", 400, response.getStatus());
assertEquals(400, response.getStatus());
assertThat(response.readEntity(String.class), containsString("Fruit serial number is not valid"));
}
@Test
public void givenCreateFruit_whenFruitIsInvalid_thenResponseCodeIsBadRequest() {
void givenCreateFruit_whenFruitIsInvalid_thenResponseCodeIsBadRequest() {
Fruit fruit = new Fruit("Blueberry", "purple");
fruit.setWeight(1);
Response response = target("fruit/create").request(MediaType.APPLICATION_JSON_TYPE)
.post(Entity.entity(fruit, MediaType.APPLICATION_JSON_TYPE));
assertEquals("Http Response should be 400 ", 400, response.getStatus());
assertEquals(400, response.getStatus());
assertThat(response.readEntity(String.class), containsString("Fruit weight must be 10 or greater"));
}
@Test
public void givenFruitExists_whenSearching_thenResponseContainsFruit() {
void givenFruitExists_whenSearching_thenResponseContainsFruit() {
Fruit fruit = new Fruit();
fruit.setName("strawberry");
fruit.setWeight(20);
Response response = target("fruit/create").request(MediaType.APPLICATION_JSON_TYPE)
.post(Entity.entity(fruit, MediaType.APPLICATION_JSON_TYPE));
assertEquals("Http Response should be 204 ", 204, response.getStatus());
assertEquals(204, response.getStatus());
final String json = target("fruit/search/strawberry").request()
.get(String.class);
@ -114,28 +114,28 @@ public class FruitResourceIntegrationTest extends JerseyTest {
}
@Test
public void givenFruitExists_whenSearching_thenResponseContainsFruitEntity() {
void givenFruitExists_whenSearching_thenResponseContainsFruitEntity() {
Fruit fruit = new Fruit();
fruit.setName("strawberry");
fruit.setWeight(20);
Response response = target("fruit/create").request(MediaType.APPLICATION_JSON_TYPE)
.post(Entity.entity(fruit, MediaType.APPLICATION_JSON_TYPE));
assertEquals("Http Response should be 204 ", 204, response.getStatus());
assertEquals(204, response.getStatus());
final Fruit entity = target("fruit/search/strawberry").request()
.get(Fruit.class);
assertEquals("Fruit name: ", "strawberry", entity.getName());
assertEquals("Fruit weight: ", Integer.valueOf(20), entity.getWeight());
assertEquals("strawberry", entity.getName());
assertEquals(Integer.valueOf(20), entity.getWeight());
}
@Test
public void givenFruit_whenFruitIsInvalid_thenReponseContainsCustomExceptions() {
void givenFruit_whenFruitIsInvalid_thenReponseContainsCustomExceptions() {
final Response response = target("fruit/exception").request()
.get();
assertEquals("Http Response should be 400 ", 400, response.getStatus());
assertEquals(400, response.getStatus());
String responseString = response.readEntity(String.class);
assertThat(responseString, containsString("exception.<return value>.colour size must be between 5 and 200"));
assertThat(responseString, containsString("exception.<return value>.name size must be between 5 and 200"));