I am trying to test a route that returns array of objects but the test fails because it returns Unauthorized instead of 200 OK My test class And A ...
I am trying to test a route that returns array of objects but the test fails because it returns Unauthorized instead of 200 OK My test class And A ...
I want to mock a data which is fetched from MDC in test class other wise when the code executed it return a null value. So i try below, But i am ge ...
I'm having issues testing a service because I can't seem to be able to mock the service response with a RestTemplate. Here's the service code: Her ...
Let's say I have the code above. I want to unit test public API (getModels and getModel methods). They use shared logic extracted into separate meth ...
in jest, we can set the title or name or description for the specific test. For simple example like below: const sum = require('./sum'); test('adds ...
I am trying to explore the Spring framework developing a very basic application based on one of my hobbies. There is a null error when trying to execu ...
I have problem with Spring Spock integration. I have SpringBoot test in Spock which set up Application Context. If for some reason Spring context is b ...
I have a separate module for functional testing of the application module. Its structure is as below Note that there is NO main folder. My pom file ...
I am trying to write some functional testings with some data pre-inserted by TestEntityManager. Below is my code @RunWith(SpringRunner.class) @Spring ...
I want to Unit test a Service A which uses several JpaRepositories. I know that I can use @MockBean annotation to mock my repositories, however, all u ...
I am getting an error I don't know how to resolve when running my basic contextLoads() test in spring boot my pom.xml My test The error on mvn ...
I'm using Junit5 for test my spring code. In the test code, I mock SetRepository, to make the getSize() method return value 40. Then I stubbed ListSe ...
I have a REST POST endpoint which is used to create an entity. I've trying to test it with MockMVC but every time that i sent the request i received a ...
I'm using Spring WebMvc 5.3 (along with the spring-test module of the same version). The mockito version I'm using is 3.6. I have a controller method ...
What's the best way to write integration tests that uses the new Spring 6 http interfaces with a mock server? Example: basically trying to discov ...
Is there any way to get TestInstance.LifeCycle (PER_CLASS or PER_METHOD) in SpringTest's TestExecutionListener ? For example , in method afterTestMet ...
I have read previous questions but there is not exact answer pointing my questions directly. My code is below: My test class is as below: I got ...
Recently, while running some tests, I wanted to use TestNG instead of JUnit. however when I added the dependency to pom file, imported the jar files. ...
JsonPath itself can be configured like this The example above enables Option.REQUIRE_PROPERTIES configuration option, so it will throw an exception ...
I have a method generated test case: And the test method: I got following error My pom file: ...