@Test public void testTileClass() { WorkflowID id = new WorkflowID("foo"); SlotState succ = new SlotState(new SlotID(id, new ScheduledTime("2015-08-06T19:27Z")), SlotState.Status.SUCCESS); SlotState fail = new SlotState(new SlotID(id, new ScheduledTime("2015-08-06T19:31Z")), SlotState.Status.FAILURE); SlotState wait = new SlotState(new SlotID(id, new ScheduledTime("2015-08-06T19:35Z")), SlotState.Status.WAITING); Assert.assertEquals("SUCCESS", UIServlet.printTileClass(ImmutableSet.of(succ))); Assert.assertEquals("SUCCESS", UIServlet.printTileClass(ImmutableSet.of(succ, succ, succ))); Assert.assertEquals("WAITING", UIServlet.printTileClass(ImmutableSet.of(succ, wait, succ))); Assert.assertEquals("WAITING", UIServlet.printTileClass(ImmutableSet.of(wait))); Assert.assertEquals("WAITING", UIServlet.printTileClass(ImmutableSet.of(wait, wait, wait))); Assert.assertEquals("FAILURE", UIServlet.printTileClass(ImmutableSet.of(fail))); Assert.assertEquals("FAILURE", UIServlet.printTileClass(ImmutableSet.of(succ, fail))); Assert.assertEquals("FAILURE", UIServlet.printTileClass(ImmutableSet.of(succ, fail, wait))); Assert.assertEquals("FAILURE", UIServlet.printTileClass(ImmutableSet.of(wait, wait, fail, wait, succ))); }
static String printTileClass(Set<SlotState> slots) { if (slots == null) { return ""; } else if (slots.size() == 1) { return slots.iterator().next().getStatus().name(); } else { return printMultiSlotClass(slots); } }
UIServlet extends HttpServlet { static String printTileClass(Set<SlotState> slots) { if (slots == null) { return ""; } else if (slots.size() == 1) { return slots.iterator().next().getStatus().name(); } else { return printMultiSlotClass(slots); } } }
UIServlet extends HttpServlet { static String printTileClass(Set<SlotState> slots) { if (slots == null) { return ""; } else if (slots.size() == 1) { return slots.iterator().next().getStatus().name(); } else { return printMultiSlotClass(slots); } }  }
UIServlet extends HttpServlet { static String printTileClass(Set<SlotState> slots) { if (slots == null) { return ""; } else if (slots.size() == 1) { return slots.iterator().next().getStatus().name(); } else { return printMultiSlotClass(slots); } }   }
UIServlet extends HttpServlet { static String printTileClass(Set<SlotState> slots) { if (slots == null) { return ""; } else if (slots.size() == 1) { return slots.iterator().next().getStatus().name(); } else { return printMultiSlotClass(slots); } }    }