Category "junit"

Quarkus : How to disable/mock Vault for unit testing

I'm currently facing an issue with Quarkus and Vault. When I launch JUnit tests, Vault trying to start and it failed because Vault configuration is not setup to

How can I mock dependencies which aren't interfaces but subclasses?

I'm not sure if my design is simply stupid, or there's a good way to make it work. Consider the following classes: public abstract class CheckBase { protect

Allure is not generating report on cucumber 7

After updating the cucumber version to 7.2.3, Allure not generating reports. (unknown report and NaN%). It still uses the config file in the directory. I think

IntelliJ IDEA breakpoints do not hit in dynamically loaded anonymous inner class

This is not your usual "my breakpoints don't work" question. Consider the following code: Runnable runnable = new Runnable() { @Override public void run()

How to exclude certain package while running the Code Coverage in spring Boot using jacoco

<plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> &l

how to fix java.lang.UnsatisfiedLinkError: sun.tools.attach.BsdVirtualMachine.createAttachFile(Ljava/lang/String;)

everyone. I was trying to execute " mvn clean test " to verify a simple maven project which was generated by "mvn archetype:generate".I just to want learning ho

FailSafe plugin is not running feature files in parallel

I have included failsafe plugin with parallel methods and threadcount 4. And framework is cucumber with junit. I'm trying to run features in parallel with fails

Java Testcontainers - Cannot connect to exposed port

I implemented a POP3 server and client using javax.mail just to try doing integration testing with Docker. So I created two Docker images based on the openjdk:8

Mockito Matcher for a TypeReference

I am trying to write a Java unit test using Mockito but am having trouble to get a matcher to work. I want to test the following class CustomService.java pub

JUnit tests fails on GitHub Actions but not locally

I am trying to run JUnit tests on GitHub Actions but some of it fails. Locally all tests passed. On my PC I am using Ubuntu 20.04 with OpenJDK 1.8 (275), on CI

Is there an equivalent of verifyZeroInteractions() for verifying an exact number of interaction with a mock object?

I would like to verify there were exactly x interactions with might db mock object. Is there something similar to the 'verifyZeroInteractions()' method for doin

Mock call to static method of a utility class

I need to write a unit test for the method processNotification. But this method internally calls JsonUtility.getNotificationDTOFromMessage. I need the return

org.powermock.api.mockito.ClassNotPreparedException when it's declared to be prepared

I don't understand why this is showing since my test definitely asked PowerMock to prepare for it. @PrepareForTest({AmazonSQSClientBuilder.class}) @RunWith(Powe

How to avoid jwt token or ignore authentication when testing HTTP API request?

mvc.perform(MockMvcRequestBuilders.get("/PensionerDetailByAadhaar?aadhaarNumber=123").header("Authorization","Bearer "+token)).andExpect(status().isOk()); Here

How to calculate from a date to another date?

I am creating a workday calendar which calculates which date the workday ends. I have a code that sets daily worktime from e.g 8:00-16:00 (workDayStartStop). An

How to register TestExecutionListener in Junit 5 and detect if all tests are executed

Hi I am trying to implement integration test using JUNIT 5 as a framework and we just want to start all the process once before all the test are executed and st

java.lang.VerifyError: class com.intellij.junit4.JUnit4TestRunnerUtil$5 overrides final method getRunner.()Lorg/junit/runner/Runner;

While running test cases from IntelliJ - facing this issue. mvn clean install works fine though. Anyone faced this issue before ?

No qualifying bean of type 'org.springframework.batch.core.Job' available: expected single matching bean but found 2:

I have 2 jobs running in single spring batch application based on input parameters and it is working successfully. But when i run my test case, i'm getting the

TestEngine with ID 'junit-vintage' failed to discover tests - JUnitException: Failed to parse version of junit:junit: 4.13.2

I'm having a very weird issue with my Gradle config and JUnit, I have tried updating to 5.7+ but I'm getting the following exceptions: org/junit/jupiter/api/ex

TestEngine with ID 'junit-vintage' failed to discover tests - JUnitException: Failed to parse version of junit:junit: 4.13.2

I'm having a very weird issue with my Gradle config and JUnit, I have tried updating to 5.7+ but I'm getting the following exceptions: org/junit/jupiter/api/ex