All Questions
933
questions
1
vote
2
answers
43
views
Run JUnit tests from multiple projects at once
I have a repository of projects, each containing JUnit tests. I am looking for either a method or a framework to run them all at once, instead of manually running for each project.
After some research ...
0
votes
1
answer
58
views
when() requires an argument, Mockito and BCrypt
I'm trying to make an unit test in a project, but i'm stuck at trying to mock the BCrypt.checkpw function, i've read that making a static mock requires a certain way to handle the test, i'm not ...
0
votes
0
answers
28
views
writing test for the upload image and get image methods in spring boot
I am working on a Spring Boot project. One of the features of the project is the ability to upload image and get image using APIs.
this is my UserServiceImpl:
package com.example.firsttask.service....
0
votes
0
answers
92
views
How to implement threshold for JUnit tests
I have Junit tests which is invoked by a test class which is called TestRunner and look like this:
@TestInstance(Lifecycle.PER_CLASS)
class TestRunner {
@ParameterizedTest(name = "{index} {0}...
-1
votes
2
answers
191
views
Are both integration test and unit test needed in all cases in Spring Boot? [closed]
I have a Spring Boot backend where i run integration tests for my controllers (endpoints) and unit tests for my service methods. For some endpoints there are just simple service calls that are ...
0
votes
1
answer
44
views
Mockito thenReturn not working in RichSourceFunction
In my unit test I am mocking the return of my Fetcher then passing it into the constructor of a nested static class Head.Source. My Fetcher gets items every 5 minutes.
The problem is that in each call ...
0
votes
1
answer
2k
views
Unit testing with RestClient - Spring boot
I'd like to add unit tests for an HTTP call, using RestClient
I've read a bit and seems like I can use @RestClientTest but that seems to be for integration tests (it starts the server).
https://www....
0
votes
0
answers
76
views
How to set declared fields after spying the system under test(sut)?
Apparently, when I try to spy the "System Under Test" object (sut) in my TestClass, while also trying to set/get a declared field from sut's class using reflection, it throws java.lang....
0
votes
0
answers
65
views
Create JUnit tests for a card validating method
I created a Java method that takes a card number and an expiry date and validates the card.
I used Luhn's algorithm for validating the card number.
public static boolean isValidCreditCard(String ...
0
votes
1
answer
186
views
Testing in libGDX with Junit on IntelliJ
It's the first time I'm working with libGDX, and I'm coding for a school project a desktop game.
It is requested to implement tests in our project of our model classes, the assignment requires to use ...
0
votes
0
answers
101
views
Avoid using "if" statements in JUnit5 Parameterized Test
I have a question regarding of the test below. I am testing my service class that:
Takes a user request
Checks if the email is present in the repository or not
Creates a salt and a hash for password ...
0
votes
2
answers
103
views
JUnit tests are not being detected
I am submitting a Hackerrank test. I have been asked to use my IDE to complete the tasks and then upload a zip folder. When I run the tests in my IDE, everything works fine however, when I upload the ...
0
votes
2
answers
86
views
Why does my test not work when splitting mocking and stubbing?
I struggle with Spock/Groovy testing.
Don't know why but in WHEN section, I cannot check number of calls and checking the value at once..
If I check one of them separatly all works fine!
This test ...
0
votes
1
answer
1k
views
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/io/ByteStreams [duplicate]
I am getting this problem. Can anyone help me?
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/io/ByteStreams
at org.seleniumhq.selenium.remote_driver/org....
0
votes
0
answers
191
views
Null object returned from repository in spring boot unit test for service layer save method
I'm currently working on writing unit tests for a Spring Boot application. Specifically, I'm trying to write a unit test for the save method in the service layer. However, when I call the save method, ...