How to prevent unit test from using util from test project?
- by calucier
I am using eclipse and I have two projects, project1 and project1-test. Below is the example layout of my projects:
project1
-src
--my.package
----MyClass.java
--my.package.util
----util.java
project1-test
-src
--my.package
----MyClassTest.java
--my.package.util
----util.java
MyClass.java makes a static call to the util.java in project1. MyClassTests.java is testing MyClass.java. When the test class runs, it fails and complains that MyClass.java is referencing a method in util.java that doesn't exist. Under project1, the method being referenced exists in util.java but under project1-test, the method doesn't.
When I run MyClassTests.java, the util.java that is being referenced from MyClass.java is from project1-test when it should be project1. Is there some way to make MyClass.java not reference util.java from project1-test when running MyClassTest.java?