@Test(expected = IllegalStateException.class) public void illegalInheritance() { ExecutionContext context = new ExecutionContext(); ExecutionContext parent = new ExecutionContext(); parent.newProperty("inherited").inherited().initial("test").makeFinal().declare(); context.newProperty("inherited").inherited().initial("test").makeFinal().declare(); context.inheritFrom(parent); }
@Test public void inheritance() { ExecutionContext context = new ExecutionContext(); ExecutionContext parent = new ExecutionContext(); parent.newProperty("inherited").inherited().initial("test").declare(); parent.newProperty("shadowed").inherited().initial("original").declare(); context.newProperty("shadowed").inherited().initial("shadowed").declare(); context.inheritFrom(parent); assertTrue(context.getProperty("inherited").equals("test")); assertTrue(context.getProperty("shadowed").equals("shadowed")); }