dhamini-poornachandra / mockito

Automatically exported from code.google.com/p/mockito
0 stars 0 forks source link

mockito-all-1.9.5 MockitoConfiguration.enableClassCache implementation missing #392

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use mockito-all-1.9.5x to mock trivial Interface or implementation class.
2. Run JUnit on MockitoBugTest 
3. Get stack trace similar to below - see last item in this Issue submission.

What is the expected output? What do you see instead?

Expect all tests to PASS.
(and all test *do* PASS under mockito-all-1.9.0)

Instead see tests
objenesisWithGcj and
mockitoBugTest_usingNew PASS,
but tests
mockitoBugTest_usingMock_Interface and
mockitoBugTest_usingMock_Impl FAIL.

What version of the product are you using? On what operating system?

Product version: mockito-all-1.9.5 or mockito-all-1.9.5-rc1
OS: Windows 7

Workaround: Use mockito-all-1.9.0.
1.9.0 does not support enableClassCache() configuration,
but you probably do not need this feature yet anyway.

Please provide any additional information below.

1/ I have attached test case files - see attached.

2/ It appears to me that
org.mockito.configuration.MockitoConfiguration.enableClassCache()
is unimplemented in mockito-all-1.9.5 and mockito-all-1.9.5-rc1,
although it is specified in org.mockito.configuration.IMockitoConfiguration .

3/ Here is stack trace:

java.lang.AbstractMethodError: 
org.mockito.configuration.MockitoConfiguration.enableClassCache()Z
at 
org.mockito.internal.configuration.GlobalConfiguration.enableClassCache(GlobalCo
nfiguration.java:63)
at 
org.mockito.internal.creation.jmock.ClassImposterizer.<init>(ClassImposterizer.j
ava:36)
at 
org.mockito.internal.creation.jmock.ClassImposterizer.<clinit>(ClassImposterizer
.java:29)
at 
org.mockito.internal.util.MockCreationValidator.isTypeMockable(MockCreationValid
ator.java:17)
at 
org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidat
or.java:21)
at 
org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImp
l.java:133)
at 
org.mockito.internal.creation.MockSettingsImpl.confirm(MockSettingsImpl.java:127
)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:50)
at org.mockito.Mockito.mock(Mockito.java:1243)
at org.mockito.Mockito.mock(Mockito.java:1120)
at 
com.example.server.MockitoBugTest.mockitoBugTest_usingMock_Interface(MockitoBugT
est.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java
:44)
at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:
15)
at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:4
1)
at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20
)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at 
org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.ja
va:79)
at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71
)
at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49
)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReferen
ce.java:50)
at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:467)
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:683)
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java
:390)
at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.jav
a:197)

Original issue reported on code.google.com by j...@idu.com on 1 Nov 2012 at 6:06

Attachments:

GoogleCodeExporter commented 8 years ago
Looks to me like enableClassCache was added due to Issue 233,
"Provide a way to reset objenesis class cache",
http://code.google.com/p/mockito/issues/detail?id=233

Original comment by j...@idu.com on 1 Nov 2012 at 6:12

GoogleCodeExporter commented 8 years ago
I believe this is a classpath issue, as this is available in the code

http://docs.mockito.googlecode.com/hg/1.9.5/org/mockito/configuration/IMockitoCo
nfiguration.html
https://code.google.com/p/mockito/source/browse/src/org/mockito/configuration/IM
ockitoConfiguration.java?name=1.9.5

Original comment by brice.du...@gmail.com on 2 Nov 2012 at 1:59

GoogleCodeExporter commented 8 years ago
this looks like 2 different Mockito versions on the classpath. Can you confirm 
and fix the classpath?

Original comment by szcze...@gmail.com on 10 Nov 2012 at 5:30

GoogleCodeExporter commented 8 years ago
In the mean time I'll invalidate this issue.

Original comment by brice.du...@gmail.com on 27 Nov 2012 at 4:54