public Function createFunction(Geoclient geoclient) { log.debug("Attempting to create function {}", this.id); WorkArea workAreaOne = this.workAreaOneConfig.createWorkArea(); WorkArea workAreaTwo = null; if (isTwoWorkAreaFunction()) { workAreaTwo = this.workAreaTwoConfig.createWorkArea(); warnIfDuplicateFieldIds(workAreaOne, workAreaTwo); } DefaultConfiguration funConf = this.configuration; if(funConf == null){ log.warn("Function.configuration is null. Defaulting to new instance."); funConf = new DefaultConfiguration(); } GeosupportFunction function = new GeosupportFunction(this.id, workAreaOne, workAreaTwo, geoclient, funConf); return function; }
@Test public void testOneWorkAreaConstructor() { assertSame(this.wa1Config, this.oneWorkAreaFunction.getWorkAreaOneConfig()); assertNull(this.oneWorkAreaFunction.getWorkAreaTwoConfig()); assertNull(this.oneWorkAreaFunction.getConfiguration()); assertFalse(this.oneWorkAreaFunction.isTwoWorkAreaFunction()); assertFalse(this.oneWorkAreaFunction.hasDefaultArguments()); }
@Test public void testTwoWorkAreaConstructor() { assertSame(this.wa1Config, this.twoWorkAreaFunction.getWorkAreaOneConfig()); assertSame(this.wa2Config, this.twoWorkAreaFunction.getWorkAreaTwoConfig()); assertNull(this.oneWorkAreaFunction.getConfiguration()); assertTrue(this.twoWorkAreaFunction.isTwoWorkAreaFunction()); assertFalse(this.twoWorkAreaFunction.hasDefaultArguments()); }
@Test public void testTwoWorkAreaArgumentsConstructor() { assertSame(this.wa1Config, this.twoWorkAreaDefaultArgsFunction.getWorkAreaOneConfig()); assertSame(this.wa2Config, this.twoWorkAreaDefaultArgsFunction.getWorkAreaTwoConfig()); assertSame(this.configuration, this.twoWorkAreaDefaultArgsFunction.getConfiguration()); assertTrue(this.twoWorkAreaDefaultArgsFunction.isTwoWorkAreaFunction()); assertTrue(this.twoWorkAreaDefaultArgsFunction.hasDefaultArguments()); }