Tim Werner

Greenhorn
+ Follow
since Feb 07, 2020
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tim Werner

I have tried to mock the File creation in order to replace it with a dummy file.

However I'm getting NullPointerException.
4 years ago
I have managed to solve the issue however I don't know how to mock a local variable like String folderLocation = propsDocu.getProperty(OUTPUT_FOLDER);
4 years ago
Hello all,

I want to test that a file is getting created by the following method from KClient calss:


my JUnit test is


however no file is being created in expected location and also in Unit log the following message is displayed:


Wanted but not invoked java.net.HttpURLConnection.getInputStream();
Actually, there were zero interactions with this mock.



What can be the reason for such a behaviour.

Regards,
4 years ago
Hello,

I need your help with the following issue related with Junit testing:


I have the following class under test:



and the following unit test



when I uncomment the  "assertEquals("res",ExceptionUtil.stackToString(throwMock));" code I'm getting a null object returned.

java.lang.AssertionError: expected:<res> but was:<null>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:834)
at org.junit.Assert.assertEquals(Assert.java:118)
at org.junit.Assert.assertEquals(Assert.java:144)
at com.vw.client.test.ExceptionUtilTest.test(ExceptionUtilTest.java:44)



I've tried to debug the method under test with Junit but without any success.

What I'm doing wrong?

Regards,

4 years ago