Skip to main content

All 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 ...
Arseni's user avatar
  • 11
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 ...
Axel Fernando Castro Jimenez's user avatar
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....
Erfan's user avatar
  • 1
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}...
Antonia Banderas's user avatar
-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 ...
Cyrill22's user avatar
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 ...
Scott's user avatar
  • 137
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....
lak's user avatar
  • 504
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....
hitesh's user avatar
  • 47
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 ...
Adrian Floroiu's user avatar
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 ...
dragoist's user avatar
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 ...
Alex_Pap's user avatar
  • 482
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 ...
mdaabis's user avatar
  • 128
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 ...
michalbarnat's user avatar
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....
hash jashan's user avatar
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, ...
msdemir's user avatar

15 30 50 per page
1
2 3 4 5
63