All Questions
1,015
questions
0
votes
0
answers
13
views
I'm trying to work testcode about Java Spring Boot 6.x Websocket code with STOMP but in trouble
public class WebSocketIntegrationTest {
@LocalServerPort
private int port;
@Autowired
private MockMvc mockMvc;
@Autowired
private ObjectMapper objectMapper;
private ...
0
votes
1
answer
42
views
Group (or merge) @Unroll tests from Spock in JUnit XML result file
I have a Spock @Unroll test like this:
@Unroll
def 'A session uses the TLS protocol #enabledProtocolsOfSocket #protocolOfSession'() {
given:
// ...
expect:
// ...
where:
...
0
votes
0
answers
23
views
ParameterizedTest JUNIT5 with suspend functions
I'm trying to clean a little bit my code and when testing my datasource I'm repeating a lot the test that returns connection and service error, and I'd like to have a bunch of code that tests ...
0
votes
1
answer
24
views
JUnit 5 - Migration - Custom test annotation no longer detected?
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)
...
1
vote
1
answer
23
views
Java unit test failing due to null KeyHolder
I'm creating new unit tests for an application and I'm stuck because the KeyHolder is not returning a valid object.
For context, here are my classes:
ScriptDao class:
@Repository
public class ...
0
votes
1
answer
46
views
junit 5 runs specific cucumber feature twice
Running Cucumber with JUnit 5 works ok as long as all feature files are run.
@Suite
@IncludeEngines("cucumber")
@ConfigurationParameter(key = Constants.FEATURES_PROPERTY_NAME, value = "...
0
votes
1
answer
32
views
Error occurred prior to updating JUnit 4 to JUnit 5
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;
...
-1
votes
1
answer
32
views
Mocking the new instance creation call inside a void method without using PowerMock
I have a class where inside a void method it does a new instance creation
public class BaseDao {
protected void setDataSource(DataSource dataSource) {
this.defaultTemplate = new ...
0
votes
1
answer
28
views
No error message provided by the last invocation of @RetryingTest
I have a test like this (language is Kotlin):
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class MyTest {
private var i: Int = 0
@RetryingTest(3)
fun go() {
Assertions....
0
votes
0
answers
30
views
Get current test method in JUnit 5 using a static mehtod
Is there a way to identify currently running test method (or that the code is not running as part of a test method) in JUnit 5 using a static method (i.e. no matter from where it's called)?.
I'm not ...
1
vote
0
answers
52
views
Tests execution order: JUnit 5 vs Maven Surefire Plugin documentation
I know that tests should not rely on the order in which they are executed but sometimes bad things happen. I have just fixed a Maven project whose tests were passing when executed by Jenkins but not ...
-1
votes
3
answers
83
views
doNothing when on abstract class method but should work when called from concreate class instance
I have following structure:
class Sample {
private Map<String A> serviceMap;
@Autowired
private List<A> services;
@PostConstruct
public void init() {
this.serviceMap = this....
0
votes
1
answer
49
views
How can I make a multiple level of mock object
Here is my example of object
@Service
public class UserSshKeyService {
private final RecordEventService eventService;
private final UserSshKeyRepository repository;
public ...
-3
votes
1
answer
69
views
Unable to perform Junit Parameterized test execution getting java.lang.Exception: No public static parameters method on class
Getting the following error when running Parameterized test. Please help.
@RunWith(Parameterized.class)
public class ParsingUtilTest {
@Test
@Parameters
public List<String[]> ...
0
votes
0
answers
30
views
I am running into an error related to a junit.jar file not found in <classpath> or <modulepath> when trying to run my tests in NetBeans
I have created Unit Tests for a project of mine and when I click "run test" on my test file, the system return this:
C:\Users\Justin Fussell\AppData\Local\NetBeans\Cache\20\executor-snippets\...