JUnit stub collides with source class [message #1219116] |
Mon, 02 December 2013 06:32 |
Curtis Bradley Messages: 1 Registered: December 2013 |
Junior Member |
|
|
Ganymede, JUnit4
I can do this outside of eclipse (shell/bat) or by adding another eclipse project. For this engagement, I need to get this working within a single eclipse project. I've been hired to add JUnit tests to a legacy app -- without refactoring the app. I know Java real well and eclipse/JUnit pretty well.
I have an eclipse project with a typical setup for source code and JUnit tests: Source code in the 'src' tree (myproject/src) and JUnit tests in a separate 'test' tree (myproject/test). Generated classes for each going into separate folders. Source is completely separate from test. No issues running the source or the JUnit tests.
Here's the problem:
I have a JUnit test for a src class a.b.DoIt. a.b.DoIt calls class a.d.e.SupportIt -- also in src. For all the usual reasons, I need a stub class for a.d.e.SupportIt in my 'test' tree. The problem is that my stub class for a.d.e.SupportIt (also named a.d.e.SupportIt) in the test tree collides with class a.d.e.SupportIt in the source tree. This is a result of the 'src' and 'test' trees sharing the same project classpath. No mystery here.
My initial thought is to configure 'src' and 'test' to use separate classpaths. I can't figure out how to do this when they're both in the same eclipse project. That being said, I'm open to any other eclipse solution -- that satisfies the following client-imposed limitations:
1) This is a legacy app. No refactoring of the source code (cannot create an interface for a.d.e.SupportIt and refactor the source to use it)
2) no 3rd party mock frameworks (easyMock, mockito)
3) cannot add another project to isolate JUnit tests from source code
4) must be solved within eclipse (a shell script/ant solution is not acceptable)
I might get them to let me use a plugin!
|
|
|
Powered by
FUDForum. Page generated in 0.03444 seconds