BaseGenerator implements Generator { protected boolean shouldAddImageConfiguration(List<ImageConfiguration> configs) { return !containsBuildConfiguration(configs) || Configs.asBoolean(getConfig(Config.add)); } BaseGenerator(GeneratorContext context, String name);  BaseGenerator(GeneratorContext context, String name, FromSelector selector); String getName(); GeneratorContext getContext();  }
@Test public void shouldAddDefaultImage(@Mocked final ImageConfiguration ic1, @Mocked final ImageConfiguration ic2, @Mocked final BuildImageConfiguration bc) { new Expectations() {{ ic1.getBuildConfiguration(); result = bc; minTimes = 0; ic2.getBuildConfiguration(); result = null; minTimes = 0; }}; BaseGenerator generator = createGenerator(null); assertTrue(generator.shouldAddImageConfiguration(Collections.<ImageConfiguration>emptyList())); assertFalse(generator.shouldAddImageConfiguration(Arrays.asList(ic1, ic2))); assertTrue(generator.shouldAddImageConfiguration(Arrays.asList(ic2))); assertFalse(generator.shouldAddImageConfiguration(Arrays.asList(ic1))); }