GH-350 Fixed NPE due to missing main class

Fixed NPE due to the missing main class - a condition that could be cause my missconfiguration
Added additional assertions
Added more descriptive error message
Added MAIN_CLASS system property to the search path
Added tests

Resolves #350
This commit is contained in:
Oleg Zhurakousky
2019-04-02 09:02:08 +02:00
parent 744a7587d3
commit 57ae22adb9
3 changed files with 53 additions and 14 deletions

View File

@@ -54,6 +54,26 @@ public class SpringFunctionAdapterInitializerTests {
}
}
@Test(expected = IllegalArgumentException.class)
public void nullSource() {
this.initializer = new AbstractSpringFunctionAdapterInitializer<Object>(null) {
};
}
@Test
public void sourceAsMainClassProperty() {
try {
System.setProperty("MAIN_CLASS", FluxFunctionConfig.class.getName());
this.initializer = new AbstractSpringFunctionAdapterInitializer<Object>() {
};
}
finally {
System.clearProperty("MAIN_CLASS");
}
}
@Test
public void functionBean() {
this.initializer = new AbstractSpringFunctionAdapterInitializer<Object>(FluxFunctionConfig.class) {