Skip to main content
1 vote
0 answers
26 views

Ignoring specific library for a module in Gradle

I have migrated our multi-module Gradle project from Mockito v1 to Mockito v3. As part of the migration, the following libraries were upgraded or added: mockito-core from 1.10.19 to 3.12.4 (and added ...
seened's user avatar
  • 43
-1 votes
0 answers
41 views

java.lang.NoClassDefFoundError: org.apache.hadoop.security.SecurityUtil (initialization failure)

I have a spark structured streaming application, with hadoop dependencies included. To support java 17 I have added below jvm args in build.gradle test { jvmArgs += [ '--add-exports=...
Ams's user avatar
  • 19
0 votes
1 answer
34 views

mock throw exception and new object seems not to be working using powermock

I have following simple test case that use powermock to mock throw exception from the method of ExceptionClass.getRandom by mocking the creation of Random object. But, from the test result, it looks ...
Tom's user avatar
  • 6,302
0 votes
1 answer
42 views

Failed to transform org.apache.hadoop.fs.FileSystem$Cache. org.apache.hadoop.fs.FileSystem$Cache$Key class is frozen

I am trying to mock the hadoop filesystem in my scala test. Any Idea how to go around this please: import java.net.URI import org.apache.hadoop.conf.Configuration import org.apache.hadoop.fs....
rahman's user avatar
  • 4,928
0 votes
1 answer
116 views

Issue with using PowerMock to a project which is using Robolectric

I am writing tests for a class which requires Android specific components to be available. Versions used: robolectric:4.10.3 powermock: 2.0.9 I am getting this error Failed to instantiate DeepCloner. ...
SyntaxSage's user avatar
0 votes
0 answers
75 views

How to throw exception with super constructor been mocked

I have an exception class public class FooStudioException extends SpamException { public FooStudioException(String message, String localizedMessage, Throwable cause) { super(...
Abhijit's user avatar
  • 63.6k
0 votes
1 answer
403 views

Power Mock and Mockito Version Incompatible

I'm working on a legacy code base using JDK 1.8. For one of my unit tests, I want to use PowerMock so that I can call the PowerMock.mockStatic() method on a static method (Provider.provider()) from ...
TechGoose's user avatar
1 vote
0 answers
91 views

How to mock constructors using mockito? [duplicate]

I am testing a method some class which has a new constructor call of BuildingBlockDbHandler.class. I was earlier using powermock to mock constructors like this way - BuildingBlockDbHandler ...
Arjun's user avatar
  • 23
0 votes
0 answers
367 views

How can you assign a mock to a private static field in Java 17?

Suppose I need to assert on the behavior of an object stored in a private static final field (and I can't change the modifiers because, for example, it's a write-only class or generated code) public ...
Powet's user avatar
  • 167
0 votes
0 answers
200 views

<module_name> Classes in bundle ' do not match with execution data. For report generation the same class files must be used as at runtime

Getting below warning and classes are not showing in code coverage: [WARNING] Classes in bundle '<module_name>' do not match with execution data. For report generation the same class files must ...
Gunjan SHrivastava's user avatar
0 votes
0 answers
92 views

Mockito exeception : java.lang.IllegalStateException: Failed to transform class

I am using JAVA 1.8 with the Javaassist version as 3.23.1 and power mock 1.6.6. I am facing this issue when I am including a class in @PrepareForTest.Here the MainClass class here is the annotations @...
Saurabh Raj's user avatar
1 vote
1 answer
506 views

NoSuchMethodException JDK17 Spring

We are working on migrating the application from jdk11 to jdk17. As we have to mock final static method we are using powermockrunner. We are using PowerMockito.mockStatic to mock the static class. If ...
mohitkira's user avatar
1 vote
0 answers
45 views

Mocking Singleton Class Constructor using Powemock

The problem is exactly similar to the one described How to mock enum singleton with jmockit?. I am using powermock with Junit in Java. there are some other singlton classes too without constructor ...
gansha9451's user avatar
0 votes
0 answers
34 views

Powermock failed to find the 'modifiers' field in method setInternalState [duplicate]

I am trying to run java test cases. Its a spring boot application. When we run the test classes we get "java.lang.RuntimeException: Internal error: Failed to find the 'modifiers' field in method ...
Joe1988's user avatar
  • 161
0 votes
0 answers
56 views

How to write JUnit test cases for Settings.Global methods?

Could you please support to write Junit test for the following functions storeDataScrollableFromSWC() and readDataScrollableFromSWC()? These belong to a viewmodel class. I tried multiple ways, but ...
Dev_Cob's user avatar
  • 97

15 30 50 per page
1
2 3 4 5
136