Dynamically obtain jboss.server.data.dir "Operty"

Asked

Viewed 55 times

0

I’m trying to test with junit in order to test if a directory can be created in the filesystem, to be able to test in all environments need to get the jboss 5.1 path dynamically via System.getProperty("jboss.server.data.dir"). When performing the test this parameter returns null, manually setting the Property works ok but could not automatically test in the various environments.

I tried to use "System Rules" to get this Property, but without success also returns null.

public final ProvideSystemProperty properties = ProvideSystemProperty.fromResource("jboss.server.data.dir");

How do I obtain in junit the property "jboss.server.data.dir" of jboss 5.1?

  • I think you should mock, until pq this is an environment setting, which thinks?

  • I’m a test beginner, I haven’t been able to study how to mock yet. Can you give me a superficial example of what a mock would look like in this case?

  • See: https://blog.caelum.com.br/facilitando-seus-testes-unidade-no-java-um-pouco-de-mockito/, then https://stackoverflow.com/a/35393623/2615692

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.