Browse all latest questions tagged Junit
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....
I want to create JUnit5 tests for Rest API. @Test public void resetRequest_NAME_AND_EMAIL_MISMATCH() throws Exception { when(userRestService.resetRequest(anyString(), anyString())).thenReturn(Boo...
So I started writing tests for our Java-Spring-project. What I use is JUnit and Mockito. It's said, that when I use the when()...thenReturn() option I can mock services, without simulating them or s...
I have a method. void (Item item) { } I want to test in Junit whether item has been modified or not. Can some one tell me how do I do that ?
I am trying to find an approach that will allow me to run a single test from a JUnit class using only command-line and java. I can run the whole set of tests from the class using the following: java...
I am currently writing some unit tests for legacy code in a rest api application. One particular api call generates a list of URIs using the UriInfo api from Jax-RS. When I mock this interface, I am a...
I'm using eclipse to run my tests with: right click test method -> Run As -> JUnit Test. This results in the following error: java.lang.UnsupportedClassVersionError: com/bazaarvoice/jolt/JsonUtils :...
I want to create JUnkt test for this endpoint: @Autowired private JwtTokenProvider jwtTokenProvider; @PostMapping("reset_token") public ResponseEntity<?> resetToken(@V...
What I miss the most in IntelliJ compared to Eclipse is the test run history window. Does anything like this exist in IntelliJ? I didn't find it anywhere so far and have looked a few times at least....
I am using mockito for unit testing and I want to skip a line. // method I am testing public String doSomeTask(String src, String dst) { // some code utils.createLink(src,dst); // some...
I have a service method. The method is accessing a third-party resource through a POST request. I am writing a test and I see an error in the logs. Service: @Override public void sendDoc(String id) t...
We are using Selenium-Webdriver on Jenkins box (running linux), to drive Firefox for testing a fairly complex web app. The web app requires the uploading of a photo for testing, and we have achieved...
I have a question about JUnit assertEquals to test double values. Reading the API doc I can see: @Deprecated public static void assertEquals(double expected, double actual) Deprecated. Use assertEqu...
How do I use JUnit to test a class that has internal private methods, fields or nested classes? It seems bad to change the access modifier for a method just to be able to run a test.
I want to test a method that deals with Bundles. I'm unable to create a (non-null) Bundle object in the test environment, though. Given the following code: Bundle bundle = new Bundle(); bundle.putSt...