LogoFactory { public Node createLogoAnimated(Stage stage) { final double preferredHeight = stage.getHeight() * 0.1d; log.info("preferredHeight = {}", preferredHeight); GazePlayAnimatedLogo gazePlayAnimatedLogo = GazePlayAnimatedLogo.newInstance((int) preferredHeight); Thread t = new Thread(() -> { try { Thread.sleep(2 * 1000); } catch (InterruptedException e) { throw new LogoCreationException(e); } SequentialTransition animation = gazePlayAnimatedLogo.createAnimation(); animation.setCycleCount(-1); animation.play(); }); t.start(); return gazePlayAnimatedLogo.getLetters(); }  Node createLogoAnimated(Stage stage); Node createLogoStatic(Stage stage);  }
@Test void shouldCreateAnAnimatedLogo() { when(stage.getHeight()).thenReturn(100d); LogoFactory logoFactory = LogoFactory.getInstance(); Pane result = (Pane) logoFactory.createLogoAnimated(stage); assertEquals(9, result.getChildren().size()); }