jQAssistant does not have a mechanism for dependency injection. This can make testing difficult.
The JiraRestClientWrapper is an abstraction layer which helps to mock requests to Jira while testing. The corresponding class is named MockedJiraRestClientWrapper. Unfortunately, there is no dependency injection in jQAssistant. Therefore, we use ENV to decide which implementation shall be used:
if (System.getenv(TEST_ENV) != null) {
return (JiraRestClientWrapper) GraphBuilder.class
.getClassLoader()
.loadClass("org.jqassistant.contrib.plugin.jira.jjrc.MockedJiraRestClientWrapper")
.newInstance();
} else {
return new DefaultJiraRestClientWrapper(url, username, password);
}
jQAssistant does not have a mechanism for dependency injection. This can make testing difficult.
The
JiraRestClientWrapper
is an abstraction layer which helps to mock requests to Jira while testing. The corresponding class is namedMockedJiraRestClientWrapper
. Unfortunately, there is no dependency injection in jQAssistant. Therefore, we use ENV to decide which implementation shall be used:This is obviously a bad solution. The ENV is set inside the JVM by the
EnvironmentOverrider
. The code has been taken from https://stackoverflow.com/questions/318239/how-do-i-set-environment-variables-from-java.Maybe using a system property could be a little bit cleaner. Maybe there is an even another solution which would be much better.