How to prevent unit test from using util from test project?
Posted
by
calucier
on Stack Overflow
See other posts from Stack Overflow
or by calucier
Published on 2013-11-05T21:36:45Z
Indexed on
2013/11/05
21:53 UTC
Read the original article
Hit count: 159
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?
© Stack Overflow or respective owner