I get the error below when trying to run the following test using Maven. I have used the mockito @spy annotation many times before and never got this issue. In the past however, my unit tests would always reside within frameworks.. Somehow this type of test doesn't run if the model is part of an external framework used is by the application.
@RunWith(MockitoJUnitRunner.class)
public class BasicTest {
@Rule
public MockEditingContext _editingContext = new MockEditingContext("ModelName");
@Dummy
@Spy
Membre membre;
@Test
public void test() {
assertTrue(true);
}
}
test(com.acaiq.certification.controleur.ControleurFusionTest) Time elapsed: 1.121 sec <<< ERROR!
com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException: <com.acaiq.fondation.acaiqCore.Membre$$EnhancerByMockitoWithCGLIB$$75eb343 0x5c7c22ce> takeValueForKey(): attempt to assign value to unknown key: 'possedeQualDirigeantAgence'.
This class does not have an instance variable of the name possedeQualDirigeantAgence or _possedeQualDirigeantAgence, nor a method of the name setPossedeQualDirigeantAgence or _setPossedeQualDirigeantAgence
at com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.handleTakeValueForUnboundKey(NSKeyValueCoding.java:1399)
at com.webobjects.eocontrol.EOCustomObject.handleTakeValueForUnboundKey(EOCustomObject.java:1562)
at com.wounit.rules.MockEditingContext.insertSavedObject(MockEditingContext.java:238)
at com.wounit.rules.MockEditingContext$DummyFacade.insert(MockEditingContext.java:88)
at com.wounit.rules.AnnotationProcessor.initializeObject(AnnotationProcessor.java:167)
at com.wounit.rules.AnnotationProcessor.process(AnnotationProcessor.java:205)
at com.wounit.rules.MockEditingContext.before(MockEditingContext.java:149)
at com.wounit.rules.AbstractEditingContextRule$1.evaluate(AbstractEditingContextRule.java:138)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
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.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37)
at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:158)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)
I get the error below when trying to run the following test using Maven. I have used the mockito @spy annotation many times before and never got this issue. In the past however, my unit tests would always reside within frameworks.. Somehow this type of test doesn't run if the model is part of an external framework used is by the application.
test(com.acaiq.certification.controleur.ControleurFusionTest) Time elapsed: 1.121 sec <<< ERROR! com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException: <com.acaiq.fondation.acaiqCore.Membre$$EnhancerByMockitoWithCGLIB$$75eb343 0x5c7c22ce> takeValueForKey(): attempt to assign value to unknown key: 'possedeQualDirigeantAgence'. This class does not have an instance variable of the name possedeQualDirigeantAgence or _possedeQualDirigeantAgence, nor a method of the name setPossedeQualDirigeantAgence or _setPossedeQualDirigeantAgence at com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.handleTakeValueForUnboundKey(NSKeyValueCoding.java:1399) at com.webobjects.eocontrol.EOCustomObject.handleTakeValueForUnboundKey(EOCustomObject.java:1562) at com.wounit.rules.MockEditingContext.insertSavedObject(MockEditingContext.java:238) at com.wounit.rules.MockEditingContext$DummyFacade.insert(MockEditingContext.java:88) at com.wounit.rules.AnnotationProcessor.initializeObject(AnnotationProcessor.java:167) at com.wounit.rules.AnnotationProcessor.process(AnnotationProcessor.java:205) at com.wounit.rules.MockEditingContext.before(MockEditingContext.java:149) at com.wounit.rules.AbstractEditingContextRule$1.evaluate(AbstractEditingContextRule.java:138) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) 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.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37) at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:158) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)