reta commented on pull request #721:
URL: https://github.com/apache/cxf/pull/721#issuecomment-743451509


   > 
   > 
   > I have an issue with EasyMock to get a generic object . I mean I have 
created the class in test with:
   > CorbaFixedAnyImplGenerator mockgen = 
control.createMock(CorbaFixedAnyImplGenerator.class);
   > CorbaFixedAnyImplGenerator gen = new CorbaFixedAnyImplGenerator(bus);
   > Class cls = gen.createFixedAnyClass(); issue is that it return a Class if 
I do
   > EasyMock.expect(mockgen.createFixedAnyClass()).andReturn(cls);
   > failed because it expect Class<Capture of ?> and not Class<?>
   
   Yeah, that's a known one, one of the ways to workaround it:
   ```
       @Test
       public void test() {
           Bus bus = new ExtensionManagerBus();
           IMocksControl control = EasyMock.createNiceControl();
           CorbaFixedAnyImplGenerator mockgen = 
control.createMock(CorbaFixedAnyImplGenerator.class);
           CorbaFixedAnyImplGenerator gen = new CorbaFixedAnyImplGenerator(bus);
           Class<?> cls = gen.createFixedAnyClass(); 
           expect(mockgen, cls);
       }
   
       private <T> void expect(CorbaFixedAnyImplGenerator mockgen, Class<T> 
cls) {
           
EasyMock.expect((Class<T>)mockgen.createFixedAnyClass()).andReturn(cls);
       }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to