### Question:
STKValidatorSupport extends DefaultValidatorSupport { @Override public void setValidationResult(ValidationStatus successful, String message) { if (successful == ValidationStatus.ERROR) { Notify.error(message, Method.TOAST); } else if (successful == ValidationStatus.WARNING) { Notify.warn(message, Method.TOAST); } boolean success = successful != ValidationStatus.ERROR; if (!success) { mySource.setLoadError(true, this); mySourceController.deactivateSource(mySource); } } STKValidatorSupport(IDataSource server, STKServerController controller); @Override void setValidationResult(ValidationStatus successful, String message);  }### Answer:
@Test public void testSetValidationResult() { EasyMockSupport support = new EasyMockSupport(); IDataSource server = support.createMock(IDataSource.class); STKServerController serverController = support.createMock(STKServerController.class); support.replayAll(); STKValidatorSupport validatorSupport = new STKValidatorSupport(server, serverController); validatorSupport.setValidationResult(ValidationStatus.VALID, null); support.verifyAll(); }
@Test public void testSetValidationResultError() { EasyMockSupport support = new EasyMockSupport(); IDataSource server = createServer(support); STKServerController serverController = createController(support, server); List<UserMessageEvent> events = New.list(); createToolbox(support, events); support.replayAll(); STKValidatorSupport validatorSupport = new STKValidatorSupport(server, serverController); validatorSupport.setValidationResult(ValidationStatus.ERROR, "Error Message"); assertEquals(1, events.size()); UserMessageEvent event = events.get(0); assertEquals(Type.ERROR, event.getType()); assertEquals("Error Message", event.getMessage()); assertFalse(event.isMakeVisible()); assertTrue(event.isShowToast()); support.verifyAll(); }
@Test public void testSetValidationResultWarning() { EasyMockSupport support = new EasyMockSupport(); IDataSource server = support.createMock(IDataSource.class); STKServerController serverController = support.createMock(STKServerController.class); List<UserMessageEvent> events = New.list(); createToolbox(support, events); support.replayAll(); STKValidatorSupport validatorSupport = new STKValidatorSupport(server, serverController); validatorSupport.setValidationResult(ValidationStatus.WARNING, "Warning Message"); assertEquals(1, events.size()); UserMessageEvent event = events.get(0); assertEquals(Type.WARNING, event.getType()); assertEquals("Warning Message", event.getMessage()); assertFalse(event.isMakeVisible()); assertTrue(event.isShowToast()); support.verifyAll(); }