FlowerDrawer implements RainbowImage.LoadPictureListener { public static FlowerDrawer newInstance(Flower flower, RainbowDrawer rainbowDrawer) { List<Integer> flowerLeafsRes = flower.getFlowerLeafRes(); return new FlowerDrawer(flower, new ArrayList<RainbowImage>(flowerLeafsRes.size()), rainbowDrawer); } FlowerDrawer(Flower flower, List<RainbowImage> flowerImages, RainbowDrawer rainbowDrawer); static FlowerDrawer newInstance(Flower flower, RainbowDrawer rainbowDrawer); void init(); @Override void onLoadSucceed(RainbowImage imageLoaded); @Override void onLoadFail(); void paintFlowerFor(Branch branch);  }
@Test public void testThatNewInstanceReturnsNotNullFlowerDrawer() { Assertions.assertThat(FlowerDrawer.newInstance(Flower.POPPY, rainbowDrawer)).isNotNull(); }
@Test public void testThatNewInstanceReturnsANewInstance() { FlowerDrawer firstInstance = FlowerDrawer.newInstance(flowerToPaint, rainbowDrawer); FlowerDrawer secondInstance = FlowerDrawer.newInstance(flowerToPaint, rainbowDrawer); Assertions.assertThat(firstInstance).isNotEqualTo(secondInstance); }