@Test public void testSmokeEveryThing() throws Exception { final Tobacco[] tobaccos = { new OldTobyTobacco(), new RivendellTobacco(), new SecondBreakfastTobacco() }; for (final Tobacco tobacco : tobaccos) { final AdvancedWizard advancedWizard = new AdvancedWizard(tobacco); advancedWizard.smoke(); assertEquals("AdvancedWizard smoking " + tobacco.getClass().getSimpleName(), appender.getLastMessage()); } assertEquals(tobaccos.length, appender.getLogSize()); }
@Override public void smoke() { tobacco.smoke(this); }
AdvancedWizard implements Wizard { @Override public void smoke() { tobacco.smoke(this); } }
AdvancedWizard implements Wizard { @Override public void smoke() { tobacco.smoke(this); } AdvancedWizard(Tobacco tobacco); }
AdvancedWizard implements Wizard { @Override public void smoke() { tobacco.smoke(this); } AdvancedWizard(Tobacco tobacco); @Override void smoke(); }
AdvancedWizard implements Wizard { @Override public void smoke() { tobacco.smoke(this); } AdvancedWizard(Tobacco tobacco); @Override void smoke();  }