@Test public void testRestoresState() { dispatcher.dispatch(); assertEquals(0, gc.getAlpha()); assertEquals(0, gc.getLineWidth()); assertNull(gc.getForeground()); }
@Test public void testDispatches() { dispatcher.dispatch(); InOrder order = inOrder(gc); order.verify(gc).drawPolyline(aryEq(new int[] {0, 1, 5, 5})); order.verify(gc).setLineWidth(3); ArgumentCaptor<Color> captor = ArgumentCaptor.forClass(Color.class); order.verify(gc).setForeground(captor.capture()); order.verify(gc).setAlpha(10); Color color = captor.getValue(); assertEquals(50, color.getRed()); assertEquals(100, color.getGreen()); assertEquals(200, color.getBlue()); order.verify(gc).drawPolyline(aryEq(new int[] {0, 1, 5, 5})); }
@Test(expected = IllegalStateException.class) public void testInvalidJsonContent() { GCOperationDispatcher dispatcher2 = new GCOperationDispatcher(gc, "[{ 'test' : 'test' }]"); dispatcher2.dispatch(); }