Category "junit"

SpringBoot Liquibase Oracle Junit test case execution fails

I have a SpringBoot application in which i use Liquibase to generate oracle schema and tables. When i run the application, it runs fine. But when i try to run t

Using PowerMockito with ArgumentCaptor

I simply try to test the following part of my service method: if (isDeleted) { LoggingUtils.info("Deleted. ingredientUuuid: {}", ingredient.getUuid()); } I

How to run one test inside a nested class with maven?

JUnit Example code: class OuterClass { @Nested class InnerClass { @Test void test() { } } } This command: mvn test -Dtest=OuterCla

My MutableStateFlow doesnt emit when called from suspend function in test

I am trying to write tests for my Repository which provides access to my Room database. For this, I wrote a Mock Database and a mock DAO: My Database: abstract

Angular testing async function generate error - 1 periodic timer(s) still in the queue

I'm trying to test that two async functions. The problem is that one of the functions is called every 10 seconds automatically. I tried to use tick() or flush()

How to write Junit for clone method catch block

My respected java developer friends. i am trying test and cover the catch block of clone method. I have wasted one week but didn't find any solution to cover c

How to mock the forEach elements which is iterate over the minioclient collection?

I am using minioClient.listObjects to fetch all the objects from s3. It returns the iterable Result<Item>. Here I was iterating over these results. public

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