Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 268169

Summary: Provide mock tests of exceptional flows
Product: [Modeling] EMF Reporter: Andre Dietisheim <adietish>
Component: cdo.net4jAssignee: Andre Dietisheim <adietish>
Status: CLOSED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: stepper
Version: 4.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 262875    

Description Andre Dietisheim CLA 2009-03-11 13:47:24 EDT
Net4j will benefit improved stability by fine grained mock-tests for exceptional flows.
Comment 1 Andre Dietisheim CLA 2009-03-31 04:09:15 EDT
while trying implement the first test I tried to mock java.nio.Buffer. There are several problems here. 
1.) The constructor has package private acces, so an instance may only be created with the tricks mock frameworks offer (serialisation, etc.). 
The mock framework we've chosen so far - the class extension to EasyMock - instantiates those classes flawlessly.
2.) several methods are final and easymock (which uses cglib behind the scenes) cannot override/mock them. 
Comment 2 Andre Dietisheim CLA 2009-03-31 04:13:40 EDT
I checked for alternatives and I suggest either: 

1.) Replace direct java.nio.Buffer usage by a delegation. I'm not very fund of this approach, I thinks that the code should not adapt to testing needs. 

2.) Use an alternative mocking framework. The 'problems' we have here is bringing it to orbit and maintain it. I think this should be worth it.

Comment 3 Eike Stepper CLA 2009-03-31 04:15:15 EDT
Ok, can you choose an alternative library and check that it fulfills our needs?
Comment 4 Andre Dietisheim CLA 2009-03-31 04:18:06 EDT
yes, I did some research and my favorite candidates for alternative mocking frameworks are

1.) https://jmockit.dev.java.net/ (which shall be used in addition to easymock)

2.) http://code.google.com/p/powermock/ which is uses easymock behind the scenes

I'll test'em and let you know which one fits best. Any comments so far?
Comment 5 Eike Stepper CLA 2009-11-01 06:00:15 EST
Rebasing all unresolved enhancement requests to 3.0
Comment 6 Eike Stepper CLA 2010-06-29 04:51:15 EDT
Rebasing all outstanding enhancements requests to version 4.0
Comment 7 Eike Stepper CLA 2011-06-23 03:59:01 EDT
Moving all open enhancement requests to 4.1
Comment 8 Eike Stepper CLA 2011-07-16 10:58:56 EDT
No interest for years. WONTFIX.
Comment 9 Eike Stepper CLA 2012-09-21 07:18:33 EDT
Closing.