junit Questions
10
Solved
Trying to migrate my project to java8 + Junit5 using IntelliJ 2017.2
I have added junit-jupiter-api version 5.0.0-M6
and junit-platform-launcher version 1.0.0-M6
Project structure is a default ...
Criminality asked 2/8, 2017 at 13:57
2
Solved
I have a class which has 2 fields of similar types. I have mocked them both. But when I use InjectMocks, inject mocks wrongly injects a single mock into both those fields.
Here is the example code ...
6
Solved
I'm receiving the following exception:
java.lang.NoClassDefFoundError: org/junit/platform/engine/ConfigurationParameters
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.<init>(JUn...
17
Solved
I am experiencing a strange behavior of Intellij IDEA 2016.3. Having a class with method foo and a JUnit test for the method when I get java.lang.Exception: No tests found matching Method foo when ...
Annunciate asked 29/11, 2016 at 10:33
10
Solved
I'm trying to get an "walking skeleton" of my app up that will use S3 for persistence. I would like to use a fake S3 service so each developer's desktop can read/write at will.
I thought mocks3 wo...
Brazil asked 7/7, 2011 at 19:28
6
Solved
This is my class for test.
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = AppConfig.class, loader = AnnotationConfigContextLoader.class)
public class UserServiceImplIT {
...
Evelyn asked 9/4, 2016 at 16:0
2
I have a method that includes transactionTemplate in it. My test works when I run debug mode but not when executed directly.
My test works when I run debug mode because I think transactional operat...
3
Solved
I know that similar question has been here already couple of times but following suggested fixes did not solve my problem.
I have a simple controller with the following endpoint:
@RequestMapping(...
Attribution asked 13/4, 2017 at 13:38
3
I read document, but I don't still get it.
The differences between this
private val myClass: MyClass = mockk(relaxed = true)
and this.
private val myClass: MyClass = mockk()
What I understood is ...
3
Solved
I have a project in android. I want to test it in junit. In the resources, insinide strings.xml I have a string array called labels_array. How can I access (get) this string array from a test metho...
3
I am trying to write unit tests for Quarkus using Mockito, but I fail mocking things.
Here is a minimal (not) working example :
package com.my.package;
import io.quarkus.test.junit.QuarkusTest;
im...
Parfitt asked 23/9, 2020 at 15:59
14
Solved
My JUnit tests are failing when running them through Maven and the Surefire plugin (version information below). I see the error message:
Corrupted STDOUT by directly writing to native stream in for...
Rittenhouse asked 21/3, 2019 at 2:20
4
Solved
I have a method that will return a list of objects of type MyClass. MyClass has many properties, but I care about type and count. I want to write a test that asserts that the returned list contains...
Watanabe asked 8/10, 2018 at 1:15
43
Solved
I have tried to run Parameterized Unit Tests in Android Studio, as shown below:
import android.test.suitebuilder.annotation.SmallTest;
import junit.framework.TestCase;
import org.junit.Test;
im...
Acreinch asked 27/5, 2015 at 6:29
5
Solved
I want to take a Junit test for Spring-boot as below:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {ApplicationTest.class})
public class TestOnSpring {
@Value("${app.na...
Vaporing asked 21/10, 2015 at 10:17
12
Solved
I am creating a Maven Spring project, which includes MVC, Data and Security.
My Spring applicationContext-*.xml files are located at \src\main\resources\spring\
My TestCase is placed at \src\test\...
Rabat asked 16/7, 2014 at 9:8
5
I'm writing a consumer which listens to a Kafka topic and consumes message whenever message is available. I've tested the logic/code by running Kafka locally and it's working fine.
While writing ...
Celadon asked 20/8, 2019 at 13:42
6
I have written some basic unit tests with Kotlin and Junit 5. Unfortunately, when I run them from Intellij IDEA, the tests are not found by Gradle.
I am getting the message "No tests found for give...
Floorboard asked 25/12, 2017 at 14:11
27
Solved
I wan to implement a Junit 5 test into Gradle project. I tried this:
Gradle configuration:
plugins {
id 'org.springframework.boot' version '2.5.5'
id 'io.spring.dependency-management' version '1....
Schoolmate asked 22/12, 2021 at 17:5
0
I am trying to log the JUnit ClassOrderer random seed using Logback, Spring Boot and Gradle. I found How can I make my JUnit tests run in random order? as related to my problem, but it uses the JUL...
Brinker asked 6/4, 2024 at 14:16
10
Solved
I have the following Logger I want to mock out, but to validate log entries are getting called, not for the content.
private static Logger logger =
LoggerFactory.getLogger(GoodbyeController.clas...
10
Solved
I'm using MapStruct, mapstruct-jdk8 version 1.1.0.Final and defining abstract class that I inject via Spring.
I'm looking at how to be able to test them via Junit Test ?
I've basicaly a main mappe...
Oralee asked 24/7, 2017 at 8:13
8
Solved
I have a function that uses the current time to make some calculations. I'd like to mock it using mockito.
An example of the class I'd like to test:
public class ClassToTest {
public long getDou...
Hunan asked 9/8, 2012 at 16:24
2
Solved
Is there a way in eclipse (Helios) to package/export my JUnit test suites (or maybe even test cases if possible) as executable jars? I know how to generate runnable jars from projects with a main c...
Carrara asked 10/1, 2011 at 15:24
3
Solved
Before stepping into the TDD cycle, I like to sketch out the tests that need to be implemented - i.e. write empty test methods with speaking names.
Unfortunately I have not found a way to "paint t...
© 2022 - 2025 — McMap. All rights reserved.