@Test public void testCreateLabelUpdateEventNodesForNoEvent() { Model sampleModel = new Model("test/test", null, null, null, null); assertEquals( 0, TurboIssueEvent.createLabelUpdateEventNodes(sampleModel, new ArrayList<TurboIssueEvent>()) .size()); }
@Test public void testCreateLabelUpdateEventNodesForSampleEvents() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { Method layoutMethod = ListPanelCard.class.getDeclaredMethod( "layoutEvents", Model.class, TurboIssue.class, List.class, List.class); layoutMethod.setAccessible(true); List<TurboLabel> labels = new ArrayList<>(); labels.add(new TurboLabel("test/test", "A1")); labels.add(new TurboLabel("test/test", "A2")); labels.add(new TurboLabel("test/test", "B1")); labels.add(new TurboLabel("test/test", "B2")); labels.add(new TurboLabel("test/test", "C1")); labels.add(new TurboLabel("test/test", "D1")); Model sampleModel = new Model("test/test", null, labels, null, null); List<TurboIssueEvent> events = new ArrayList<>(new TurboIssueEventTests().sampleEvents); List<Node> nodes = TurboIssueEvent.createLabelUpdateEventNodes(sampleModel, events); assertEquals(5, TurboIssueEvent.createLabelUpdateEventNodes(sampleModel, events).size()); assertEquals(5, ((HBox) nodes.get(0)).getChildren().size()); assertEquals(5, ((HBox) nodes.get(1)).getChildren().size()); assertEquals(4, ((HBox) nodes.get(2)).getChildren().size()); assertEquals(4, ((HBox) nodes.get(3)).getChildren().size()); assertEquals(4, ((HBox) nodes.get(4)).getChildren().size()); assertEquals( 5, ((VBox) layoutMethod.invoke( null, sampleModel, new TurboIssue("test/test", 1, "issue"), events, new ArrayList<Comment>())) .getChildren() .size()); }
@Test public void testCreateLabelUpdateEventNodesForNonExistentLabel() { List<TurboLabel> labels = new ArrayList<>(); Model sampleModel = new Model("test/test", null, labels, null, null); List<TurboIssueEvent> events = new ArrayList<>(); events.add( new TurboIssueEvent( new User().setLogin("A"), IssueEventType.Labeled, new GregorianCalendar(2015, 1, 1, 1, 1, 0).getTime()) .setLabelName("X")); assertEquals(1, TurboIssueEvent.createLabelUpdateEventNodes(sampleModel, events).size()); }