Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

ModbatTestHarness.scala.setTestJar does not set CLASSPATH correctly #54

Closed
4 tasks
cyrille-artho opened this issue May 21, 2019 · 0 comments
Closed
4 tasks

Comments

@cyrille-artho
Copy link
Owner

cyrille-artho commented May 21, 2019

For unit testing, we need to override environment variable CLASSPATH.

To achieve this, use the code described under
"For use in scenarios where you need to set specific environment values for unit tests"
at https://stackoverflow.com/questions/318239/how-do-i-set-environment-variables-from-java

Use that and change System.setProperty to setEnv.
You also have to create a new Map "newEnv" with one entry that you pass to setEnv.

Once this works, the extra argument "--classpath=build/modbat-test.jar" can be removed in all (about 10) tests in src/test/scala:

  • src/test/scala/modbat/mbt/ChooseTest.scala
  • src/test/scala/modbat/mbt/InvokeTransitionTest.scala
  • src/test/scala/modbat/mbt/SetWeightTest.scala
  • src/test/scala/modbat/mbt/TimeTest.scala
AlexandreFournel pushed a commit to AlexandreFournel/modbat that referenced this issue May 22, 2019
cyrille-artho pushed a commit that referenced this issue May 22, 2019
…ectly now (#56)

Add setEnv to update the environment variable for testing; remove redundant "classpath" command line argument in test cases.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant