Context { protected String getName() { return this.commandFile != null ? this.commandFile.getName() : null; } Context( AbstractApplication app, File commandFile ); boolean instanceExists( String instancePath ); Instance resolveInstance( String instancePath ); final Map<String,String> instancePathToComponentName; final Map<String,String> variables; final Set<String> disabledVariables; }
@Test public void testConstructor() { List<Instance> instances = InstanceHelpers.getAllInstances( this.app ); Assert.assertEquals( instances.size(), this.context.instancePathToComponentName.size()); for( Instance instance : instances ) { String path = InstanceHelpers.computeInstancePath( instance ); Assert.assertEquals( instance.getComponent().getName(), this.context.instancePathToComponentName.get( path )); } }
@Test public void testGetName() { Assert.assertEquals( "test", new Context( this.app, new File( "test" )).getName()); Assert.assertNull( new Context( this.app, null ).getName()); }