Using stubs in a basic Java maven project -


i have basic maven project folder structure: -main , -test directories.

i have 1 package in main source directory consists of few classes, a.class b.class , c.class, under same package. classes have dependencies each other. proper unit testing, , cut dependencies each class, write stub classes of each a, b , c class, define them have same package , put them inside test source directory. run: mvn test

fine, stubs being found first classpath , used, want modify classpath (on fly?) that, when testing class a, need have original a.class , stubs used b.class , c.class. similarly, when testing class b, need have original class b , stubs used a.class , c.class.

how accomplish using maven , junit?

this kind of frustrating in java, because in c++, 1 can use makefile source path , user defined include paths in unit test header files force stubs found first , explicitly add include original class tested.

if have dependent classes schould use interface each class. can resolve dependency problems actually...


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -