Lately I am writing junit test cases and I came across ZonedDateTime.now() works partially expected where the method which we try to write test case u ...
Lately I am writing junit test cases and I came across ZonedDateTime.now() works partially expected where the method which we try to write test case u ...
I have a class A which has a methodA calling a methodB in class B. In class B methodB is calling methodC in class C. Class C implements methodC. I ...
I have a view model class, SampleViewModel, that has an observer, DataSourceObserver, whose event's (e.g. onDataUpdated) are triggered from a private ...
I'm trying to test a private method which takes the below parameters as input : ClassToBeTested TestClass I end up getting the below error : ...
I'm testing a method with a void return type, with one parameter. I'm trying to get at least some code coverage. Here's a method I'm testing: The V ...
I am writing a class which handles formatting input text with given pattern. I am using android.icu.text.DecimalFormat and android.icu.text.DecimalFor ...
I want to mock a data which is fetched from MDC in test class other wise when the code executed it return a null value. So i try below, But i am ge ...
Mockito is returning "java.lang.IllegalArgumentException: URI is not absolute" in RestTemplate.exchange. I am not sure why this is happening because i ...
I am trying to write unit tests for the following Filter class, but I am not sure how it can be done. I am working on a Spring project and trying to f ...
I want to test a service class which extends an abstract class using Mockito. My code looks like following : Concerting the test, I am using Mockit ...
I have created a custom Predicate below and want to test it using mockito. I am creating the mocks of the specific exception classes since these dont ...
I want to test the method calculateApiTokenExpireDate(). I created a spy for currentDateTime() so that it returns static date. But it still returns th ...
I am testing return values in a method but need to also test exceptions. Below is a code snippet of one of the exceptions - how should I test this ? ...
I have to test a method with testNG framework: But i get a Nullpointer in when(Base64.getUrlEncoder()... java.lang.NullPointerException at com.c ...
I have a case class that represents a phone number, and provides some helper methods that are used elsewhere in the code. One of these methods calls o ...
I need to be able to skip over the s3Client line below when myMethod is executed from a junit. MyClass is NOT mocked, nor is myMethod: In the junit ...
I have to write a test case to cover a method which has a callback as one of the parameters. It looks something like the snippet below. How do cove ...
I am new to test driven development. I am trying to test if an object has been successfully saved into my db. My code so far: This is the method th ...
I have the following class I have another class What's the best way to test this method? Should I get the expected value by calling the method ...
I'm trying test a RestAPI in Java, but I can't mock my Service class When start test, it gives me an error: java.lang.NullPointerException: Cannot in ...