Skip to main content
Filter by
Sorted by
Tagged with
3 votes
1 answer
328 views

I'm organizing my tests using JUnit 5's @Suite and @SelectClasses, but need to control the execution sequence of the test classes. According to the documentation, @SelectClasses doesn't guarantee ...
Abhiram Reddy Milkuri's user avatar
2 votes
1 answer
85 views

I'm testing that: @RunWith(SpringRunner.class) @DataJpaTest @Import({ OrderService.class, UserService.class }) @AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) public class ...
VezzoLayer's user avatar
0 votes
1 answer
60 views

Given: Java 8 Mockito 4.3 Junit 4.11 Here my java code: public interface ClientListener { void addClientStatusListener(StatusListener statusListener); } @FunctionalInterface public interface ...
Alexei's user avatar
  • 16k
0 votes
1 answer
157 views

Java 8 Maven 3.9. I want to verify is void private method call. I try PowerMock. pom.xml <properties> <powermock.version>2.0.2</powermock.version> </properties> ...
Alexei's user avatar
  • 16k
0 votes
1 answer
173 views

After updating Android libraries (including Kotlin) I found that @BeforeTest became unresolved (@Before is resolved, it belongs to org.junit). import org.junit.Before import org.junit.Test import org....
CoolMind's user avatar
  • 29.2k
-1 votes
1 answer
570 views

gradle failed to find my test. already switching between JUnit too and its still not fix it, and it still give same error as its not found. i tried everything to find a way to look for solution but no ...
nadiff's user avatar
  • 1
0 votes
1 answer
693 views

I currently migrated a project from JUnit4 to JUnit5. The test classes are a mixture of JUnit and TestNG. My current maven plugin is written in the parent POM like: <!-- https://mvnrepository.com/...
hell_storm2004's user avatar
0 votes
2 answers
428 views

I Have an SpringBoot 2.7.18 with H2 2.3.232, with this SQL for testing: CREATE TABLE IF NOT EXISTS EXERCICE ( EXERCICE_ID NUMBER AUTO_INCREMENT, TYPE_SITE_ID NUMBER, ...
Nunyet Calçada's user avatar
0 votes
0 answers
69 views

I'm trying to test my Helper class which is a Kotlin class in Android Studio. I've JUnit dependencies as it is that I get with new Project creation. But, whenever I try to run test, I get ...
Shivanshu Raj's user avatar
1 vote
0 answers
104 views

I've tried to make some tests for Service layer in my java project. The test supposed to simply mock adding a new patient to database. After constantly failing, I simply gave up, and came here for ...
SlipperyBarrel's user avatar
1 vote
1 answer
191 views

This used to work in spring-boot v2 but after upgrading to spring-boot v3 test case gives error. The @Value annotation is not picking the right value from application.properties file because the ...
Abhishekj2096's user avatar
0 votes
0 answers
50 views

I haven't mocked the configuration class for cache config properties. Can someone help me with possible unit tests for this cacheable layer ? CacheConfig.java import com.github.benmanes.caffeine.cache....
TechGeek's user avatar
  • 508
0 votes
1 answer
140 views

I have a fragment in my app that requests the user to upload an image. How can I write a Junit test that runs on the emulated device that would select and image from the pop up? I am also wondering if ...
Griffin Frankiw's user avatar
0 votes
0 answers
244 views

I'm migrating our tests from JUnit 4 to JUnit 5, and I'm noticing a substantial increase in execution time for tests using Mockito. Specifically, empty tests take almost 100 times longer with JUnit 5. ...
Mathias Pichler's user avatar
1 vote
0 answers
69 views

org.mockito.exceptions.base.MockitoException: Mockito cannot mock this class: interface javax.servlet.http.HttpServletRequest. Mockito can only mock non-private & non-final classes. If you're not ...
Ranjani-devz's user avatar
0 votes
0 answers
56 views

I'm developing an application in Android Studio for Windows. When attempting to run one of the JUnit4 tests I've created, I get this error: > Task :app:testDebugUnitTest FAILED Error: Could not ...
BetaBites's user avatar
0 votes
0 answers
120 views

I have a legacy Spring Service that I am trying to update to remove a log4j vulnerability. I have updated the relevant dependencies/code and my project builds, compiles and runs successfully. However ...
Mathew's user avatar
  • 3
0 votes
0 answers
95 views

I want my test suite to only run the @Tagged tests and ignore the ones annotated with @RunWith. I have JUnit 4 and 5 tests. I have a test suite that uses @IncludeTags("myTag"). I have JUnit5 ...
BlairCalgary's user avatar
0 votes
1 answer
58 views

The legacy project I'm working on uses both JUnit4 and TestNG testing frameworks and for reasons beyond my control I cannot upgrade to JUnit5. While all new test-suites (classes) that we create are ...
y2k-shubham's user avatar
  • 11.9k
3 votes
0 answers
170 views

In VS Code, using JUnit. I am testing addition() method of calculator class. I have used assertEqual method to compare expected result and actual result. This is my code for test method: @Test ...
Devangi Kotak's user avatar
0 votes
0 answers
162 views

I’m porting an application to Quarkus, and am now updating its tests to use Quarkus as well. I could port successfully the JUnit 5 tests using @QuarkusTest and @TestHTTPResource: package com.example....
Nicolapps's user avatar
  • 1,012
0 votes
1 answer
244 views

I am migrating code from JUnit 4 to JUnit 5. Is there any replacement for the method Assume.assumeThat?
LoPoBo's user avatar
  • 1,877
1 vote
0 answers
181 views

My instrumentation test is not executed in the device after the test and app install. The test sometimes keep "building" for long times +15min Here is the logcat with warnings and info ...
user avatar
-1 votes
1 answer
78 views

I am trying to write a unit test (using Mockito) for my Spring Security config class and it has this code @Bean public GrantedAuthoritiesMapper authoritiesMapper() { return (authorities) -> { ...
XAJA's user avatar
  • 37
1 vote
0 answers
44 views

I've a scenario, API service running in springboot and trying to port the existing functional Test to karate based testing. I've added. the API endpoint based configuration and other validation for ...
Krish S's user avatar
  • 11
0 votes
1 answer
53 views

I am doing an instrumentation test of Fragment is displayed or not. When I start the test it execute, I am able to see FragmentLogin view in physical device but test fail by saying androidx.test....
Dnveeraj's user avatar
  • 138
0 votes
0 answers
55 views

How to write assert or verify for these. I cannot change the code in any way. Only Junit can be written by me. public void Calculator(booker, product) { Matcher matcher = buildCriteria(product); ...
DropKick's user avatar
0 votes
1 answer
65 views

I had the following custom test annotation that worked in JUnit4 that IntelliJ and JUnit no longer wants to recognize: @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE }) @Retention(RUNTIME) ...
David S's user avatar
  • 319
0 votes
0 answers
53 views

I recently mavenized few old projects. When I am trying to build caffeine tests project with maven build, the test suite hangs when it executes the first test. I debugged the application, it adds all ...
Vishnu Ramesh's user avatar
0 votes
0 answers
47 views

I'm writing tests using Junit4 and mockito and wondering if there is a possibility to check if specific exception was thrown and handled inside tested method. What I mean is - I have for example ...
r17's user avatar
  • 1
1 vote
0 answers
67 views

How to mock a final class to return nothing when a function from a final class is called? In test method: @InjectMocks CustomerService customerService; @Mock AddCustomerProfile addCustomerProfile; @...
John K Jose's user avatar
0 votes
1 answer
161 views

Before the update, don't run my class RunTest, get a error in execution package automation; import org.junit.FixMethodOrder; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; ...
Lucas Tenório's user avatar
0 votes
0 answers
88 views

I have an exception class public class FooStudioException extends SpamException { public FooStudioException(String message, String localizedMessage, Throwable cause) { super(...
Abhijit's user avatar
  • 64.1k
1 vote
0 answers
207 views

We're upgrading from Java 8 to 21 and since we run Arquillian with a remote Wildfly for integration testing, but also have some mocking inside those test classes to avoid to execute some annoying code,...
MJCM's user avatar
  • 53
0 votes
1 answer
33 views

I want to test this KeyStoreConfig class but what ends up happening is jceksFileLocation is always null and returns an error What can I do to test this class thoroughly. If I could somwhow populate ...
Juicy Jay's user avatar
  • 109
0 votes
1 answer
55 views

I'm writing a junitTest that should test a serverHandler object that handle the reciving and sending of message to a server. I'm doing that by mocking the socket of the server and putting my own ...
Samuele's user avatar
  • 11
0 votes
1 answer
58 views

I have a class like below class Foo{ @AutoWired private Bar bar; @AutoWired public Foo(List<Baz>){ // do something with Baz } how can I control which Baz will be injected, like only ...
Frank Bao's user avatar
0 votes
1 answer
83 views

I started a Selenium + JUnit 4 Test from the two getting started documents. I am on Maven3, Java17 and IntelliJ IDEA w/ Arch Linux. My pom.xml is as follows: <?xml version="1.0" encoding=&...
Leder's user avatar
  • 394
1 vote
1 answer
517 views

I've seen some old questions about using the regular mockito mock maker. i.e. using the mockito-core dependency. I think this is not a duplicate because I'm using the new inline mock maker from ...
majinnaibu's user avatar
  • 3,150
0 votes
1 answer
105 views

According to the firebase documentation I should be able to specify multiple test target filters - https://cloud.google.com/sdk/gcloud/reference/firebase/test/android/run#--test-targets I've specified ...
Boyana Staneva's user avatar
0 votes
0 answers
38 views

I have abc.json file inside Assets folder of the Android project. Everything is working in the application. i.e, able to read this file when launching the app on the phone. Junit test to validate the ...
Vinit ...'s user avatar
  • 1,469
0 votes
0 answers
320 views

I have a Jhipster project that uses spring boot 1.5.12.RELEASE and I want to add tests for the repositories using @DataJpaTest. There are also some ITs in the project without @DataJpaTest and ...
Tom's user avatar
  • 171
3 votes
2 answers
992 views

I have a viewmodel class that uses a StateFlow that is created using the StateIn operator. I.E. private val _state = MutableStateFlow(MyState()) private val myItems = myRepository.myFlow.stateIn( ...
tomerpacific's user avatar
  • 6,881
0 votes
0 answers
55 views

public String addMaquette(MultipartFile maquette, String keySousRubrique, String projectId, String titrePage) throws IOException { DBObject metadata = new BasicDBObject(); metadata.put("...
ismail fourati's user avatar
0 votes
1 answer
2k views

I added the parallel and threadcount lines to surefire plugin configuration in pom file: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-...
JustCallMeDan's user avatar
0 votes
1 answer
146 views

I am learning java and exploring junit with Mockito. The idea is to understand where and how to use mockito and learn how to write junit tests. Im a beginner and learning. How can i write a junit test ...
User1515's user avatar
0 votes
1 answer
54 views

I have a repository class that works with a Proto DataStore I have defined that is NOT the Preference DataStore equivalent. My proto file looks something like this: syntax = "proto3"; ...
tomerpacific's user avatar
  • 6,881
0 votes
0 answers
536 views

import static org.springframework.restdocs.request.RequestDocumentation.requestParameters; User java: cannot find symbol symbol: static requestParameters location: class org.springframework....
daoony's user avatar
  • 11
0 votes
1 answer
82 views

Is it possible to run an instrumented test in an Android module that has no activity but uses AppCompat dependencies? I am attempting to run a simple test but only works if moved to app module. Util ...
Bitwise DEVS's user avatar
  • 3,871
-1 votes
1 answer
335 views

Env: 2 datasources - one PostgreSQL and MongoDB JDK 17 Spring Boot 3.1.1 JUnit 4 eventRepository is not returning mock when called by updateScheduler Service for @DataJpaTest. Everything bellow works ...
Goldman7911's user avatar

1
2 3 4 5
83