Skip to main content

All Questions

Tagged with
1 vote
0 answers
18 views

SpringBootTest with Togglz

I just recently added togglz to the spring-boot 3.1.9 application, which contains also much stuff like spring-security, spring-data, etc. Maven dependency: <dependency> <groupId>org....
Georgii Lvov's user avatar
  • 2,474
-1 votes
2 answers
59 views

How to write a unit test with a controller method that has protected code in it [duplicate]

I am trying to write a unit test for the following controller: @RestController @RequestMapping(value = ENDPOINT_URL) public class MainController extends RestControllerBase { MainService ...
aCarella's user avatar
  • 2,474
0 votes
1 answer
48 views

How to use class member variables inside Junit-Mockito tests

class MyClass { MyErrorServiceList myErrorServiceList; // myErrorServiceList is initialized by some complex method calls public boolean processErrorServiceList() { if (...
Henry Passion's user avatar
0 votes
0 answers
33 views

I created a test case method named 'testRegisterCustomerSuccess,' but it encountered issues related to JPA queries

I have a method named registerCustomer in a service implementation class. I created a test case named testRegisterCustomerSuccess for this method in a class named UserServiceImplTest, where I mock ...
Prince Lathiya's user avatar
1 vote
1 answer
38 views

Sprinboot api application performance test

I want to test the performance of my backend REST API application written with Spring Boot under high requests. How can I perform this process? Which tools should I use and what should I do step by ...
scofield1's user avatar
0 votes
2 answers
56 views

Junit local object mock with arguments

I want to use mockito for mocking the constructor call when a specific argument is passed. Lets say this is my class - public class MyTestClass { private final String argument; public ...
Arjun's user avatar
  • 13
-1 votes
1 answer
39 views

In my Spring setup with DbSetUp + H2 database, queries with LIKE are not working

As the title suggests, what I want to do is test a class with database access in a Spring Boot application. In the target class, I am using Specification as follows: TestSpecification specification = ...
harunaga's user avatar
  • 355
0 votes
0 answers
38 views

How can I remove all running docker containers after all tests in a JUnit test suite have finished running?

I have a JUnit test suite that comprises of 3 smaller test suites. When these tests are run, 2 docker containers are spun up (an oracle slim db and an elasticsearch). I want to be able to remove these ...
Syed Ali's user avatar
-1 votes
1 answer
164 views

How to mock a repository with Spring Data JPA + Specification

There is a basic CRUD API, and I want to test the UserServiseImpl.java class in its Service layer. In UserServiseImpl, entities are retrieved with userRepository.findAll(query) as shown below, and I ...
harunaga's user avatar
  • 355
0 votes
1 answer
81 views

Mockito Test Fails with 'Wanted but not Invoked; Actually, there were zero interactions' Error

I'm facing issues with a unit test in a Spring Boot application where a specific repository method isn't being called as expected during the test of a service method. Despite setting up the test with ...
Japkutija's user avatar
1 vote
0 answers
89 views

How to mock constructors using mockito? [duplicate]

I am testing a method some class which has a new constructor call of BuildingBlockDbHandler.class. I was earlier using powermock to mock constructors like this way - BuildingBlockDbHandler ...
Arjun's user avatar
  • 13
0 votes
1 answer
48 views

How to write JUnit test for Gateway Application in Spring Boot Microservices

I have a problem to implement some JUnit test for Gateway Application in Spring Boot Microservices Here is the Gateway Service Application shown below @EnableDiscoveryClient @SpringBootApplication ...
jacksondel's user avatar
0 votes
0 answers
31 views

Testing method annotated with @Cacheable

I have to test a method thats annotated with @Cacheable like this im not,that skilled so this may be wrong. @Trace @Cacheable(value = "pp-search") public Response search(final ...
AG Garcia's user avatar
0 votes
2 answers
288 views

NoSuchMethodError: 'java.util.Set org.junit.platform.engine.TestDescriptor.getAncestors() when running Spock Spring Boot unit tests

Context I have a unit test written using the Spock Testing framework to test my Spring Boot application. I've declared the following test dependencies: spock-spring: 2.3-groovy-4.0 spring-boot-...
roj's user avatar
  • 1,343
0 votes
0 answers
52 views

SpringBoot configuration

I'm trying to run the following code using JUnit test (Run As -> JUnit Test). I'm using Maven for dependency management, so I would have and understand that it's a configuration issue. I've seen ...
Jaime Camacho's user avatar

15 30 50 per page
1
2 3 4 5
98