@Test public void testShowSimpleData() throws Exception { KBaseModel config = new KBaseModel(); config.setName("Name"); config.setEqualsBehavior(AssertBehaviorOption.EQUALITY); config.setEventProcessingMode(EventProcessingOption.CLOUD); config.getStatelessSessions().put("1", createStatelessKSession("1")); config.getStatelessSessions().put("2", createStatelessKSession("2")); config.getStatelessSessions().put("3", createStatelessKSession("3")); config.getStatefulSessions().put("4,", createStatefulKSession("4")); config.getStatefulSessions().put("5,", createStatefulKSession("5")); form.setModel(config); verify(view).setName("Name"); ArgumentCaptor<Map> statelessSessionModelArgumentCaptor = ArgumentCaptor.forClass(Map.class); ArgumentCaptor<Map> statefulModelArgumentCaptor = ArgumentCaptor.forClass(Map.class); verify(view).setStatefulSessions(statefulModelArgumentCaptor.capture()); verify(view).setStatelessSessions(statelessSessionModelArgumentCaptor.capture()); verify(view, never()).setEventProcessingModeStream(); verify(view).setEventProcessingModeCloud(); verify(view, never()).setEqualsBehaviorIdentity(); verify(view).setEqualsBehaviorEquality(); assertEquals(3, statelessSessionModelArgumentCaptor.getValue().size()); assertEquals(2, statefulModelArgumentCaptor.getValue().size()); }
@Test public void testEventProcessingModeStreamChange() throws Exception { KBaseModel config = new KBaseModel(); form.setModel(config); // Default assertEquals(EventProcessingOption.STREAM, config.getEventProcessingMode()); // Toggle presenter.onEventProcessingModeCloudSelect(); assertEquals(EventProcessingOption.CLOUD, config.getEventProcessingMode()); presenter.onEventProcessingModeStreamSelect(); assertEquals(EventProcessingOption.STREAM, config.getEventProcessingMode()); }
@Test public void testEqualsBehaviorChange() throws Exception { KBaseModel config = new KBaseModel(); form.setModel(config); // Default assertEquals(AssertBehaviorOption.IDENTITY, config.getEqualsBehavior()); // Toggle presenter.onEqualsBehaviorEqualitySelect(); assertEquals(AssertBehaviorOption.EQUALITY, config.getEqualsBehavior()); presenter.onEqualsBehaviorIdentitySelect(); assertEquals(AssertBehaviorOption.IDENTITY, config.getEqualsBehavior()); }
@Test public void testCleanUp() throws Exception { verify(view).setPresenter(presenter); form.setModel(new KBaseModel()); verify(view).setName(null); ArgumentCaptor<Map> statelessSessionModelArgumentCaptor = ArgumentCaptor.forClass(Map.class); ArgumentCaptor<Map> statefulModelArgumentCaptor = ArgumentCaptor.forClass(Map.class); verify(view).setStatefulSessions(statefulModelArgumentCaptor.capture()); verify(view).setStatelessSessions(statelessSessionModelArgumentCaptor.capture()); verify(view).setEventProcessingModeStream(); verify(view, never()).setEventProcessingModeCloud(); verify(view).setEqualsBehaviorIdentity(); verify(view, never()).setEqualsBehaviorEquality(); assertEquals(0, statelessSessionModelArgumentCaptor.getValue().size()); assertEquals(0, statefulModelArgumentCaptor.getValue().size()); }