junit Questions
2
Solved
Currently I build my Gradle app by running gradle clean build. This exercises JUnit tests and produces XML test results in my project under build/test-results. I would like to configure my build.gr...
3
I'm having a minor problem with running unit tests against a real device when testing activities.
The problem is that they fail when the screen is not turned on.
Is there an elegant solution to ...
3
Solved
I have a project in IntelliJ that has a number of syntactically correct and incorrect classes and a unit test that I've written for a particular class.
Is there a way to execute the test even tho...
Climax asked 28/4, 2017 at 12:37
4
I have multiple packages under a folder for which tests were written. These tests pass when run as a Class or from the residing package. But when I run it from the folder as a whole, the tests are ...
7
Solved
I get this error while running a JUnit test in Spring Tool Suite (4.20.0).
Test runs fine, but this error is thrown at the end -
java.lang.NoSuchMethodError: 'java.util.Set org.junit.platform.engin...
Admetus asked 6/10, 2023 at 3:58
5
Solved
I am new in IntelliJ IDEA and I want to execute a single Junit test as I do in Eclipse but I haven't seen this option
Deepsix asked 1/7, 2019 at 18:36
9
Solved
I’m using Mockito 1.9.5. How do I mock what is coming back from a protected method? I have this protected method …
protected JSONObject myMethod(final String param1, final String param2)
{
…
}
H...
5
Solved
5
Solved
I am using maven to develop a java project within visual studio code, and am currently trying to write a test class.
I have added junit as a dependency to my pom.xml file:
<dependency>
&l...
Leonhard asked 28/5, 2020 at 22:16
4
Is it no option to exclude some tests in IntelliJ IDEA Ultimate? I want to run unit tests in IntelliJ but exclude the integration tests. I name the integration tests with *IT.java so the Maven fail...
Clavus asked 27/10, 2012 at 21:29
5
Solved
The dependsOnMethods attribute of the @Test annotation works fine when the test to be depended upon is in the same class as that of the test that has this annotation. But it does not work if the to...
Patience asked 7/10, 2011 at 19:42
7
Solved
I have some common set up code that I've factored out to a method marked with @Before. However, it is not necessary for all this code to run for every single test. Is there a way to mark it so the ...
Destructive asked 10/10, 2009 at 16:53
7
Solved
Is there an embedded PostgreSql so that we could unit test our PostgreSql driven application?
Since PostgreSql has some dialects, it's better to use embedded PostgreSql itself than other embedded...
Tanana asked 14/1, 2013 at 6:12
9
Trying to implement cucumber to do some automated tests. jUnit tests. I've created 2 files and edited pom.xml that comes with maven project to add dependencies. Content is shown below. The first of...
Amphitropous asked 12/2, 2014 at 20:9
9
Solved
I have started testing and now i want to use @After, @Before and @Test but my application only runs the @Before method and gives output on console
before
However, if I remove @After and @Befor...
6
I am testing a method which is protected. In my test case I've used Reflection to access the method but I am not exactly sure whether I am doing it in a right way.
Method to be tested:
protected ...
Reprovable asked 3/2, 2016 at 20:6
2
Junit test case getting failed:
existing static mocking registration must be deregistered
Test class:
@RunWith(MockitoJUnitRunner.class)
public class DeleteReportServiceTest {
@InjectMocks
pri...
9
Solved
Currently I have to create a parameterized test class for every method that I want to test with several different inputs. Is there a way to add this together in one file?
Right now there's Calcula...
Willumsen asked 29/12, 2012 at 13:10
3
Solved
I have a CSV and I want to check if it has all the data it should have. But it looks like ZWNBSP appears at the beginning of the 1st column name in the 1st string.
My simplified code is
@Test
void ...
Atonality asked 4/5, 2022 at 5:39
7
Solved
How can I tell the @Sql annotation to run only once for the class, and not for each @Test method?
Like having the same behaviour as @BeforeClass?
@org.springframework.test.context.jdbc.Sql(
scri...
Mages asked 12/12, 2017 at 14:56
5
Solved
I have this on my build.gradle:
testCompile(group: 'junit', name: 'junit', version: '4.+')
It resolves to:
junit:junit:4.+ -> 4.12-beta-1
I don't want to use beta releases but at the same...
4
Solved
I have just upgraded my solution to use JUnit5. Now trying to create tags for my tests that have two tags: @Fast and @Slow. To start off I have used the below maven entry to configure which test to...
4
Solved
I have a class that has the @Slf4j annotation.
I try to write a test and mock the Logger, but it does not work.
@RequiredArgsConstructor
@Slf4j
public abstract class ExampleClass {
protected fin...
Fur asked 26/3, 2021 at 11:58
14
When I try to run my test I get the following Errors:
Error:(3, 24) java: package org.junit does not exist
Error:(3, 1) java: static import only from classes and interfaces
Error:(5, 17) java: pack...
Hygienist asked 20/4, 2015 at 7:34
7
Solved
I'm trying to create a JsonProcessingException to be thrown by a mock object.
when(mapper.writeValueAsString(any(Object.class))).thenThrow(new JsonProcessingException("Error"));
However I'm una...
1 Next >
© 2022 - 2025 — McMap. All rights reserved.