### Question:
SlackNotificationListener extends BuildServerAdapter { public void register(){ myBuildServer.addListener(this); Loggers.SERVER.info("SlackNotificationListener :: Registering"); } SlackNotificationListener();  SlackNotificationListener(SBuildServer sBuildServer, ProjectSettingsManager settings,
                                     SlackNotificationMainSettings configSettings, SlackNotificationPayloadManager manager,
                                     SlackNotificationFactory factory); void register(); void getFromConfig(SlackNotification slackNotification, SlackNotificationConfig slackNotificationConfig); @Override void buildStarted(SRunningBuild sRunningBuild); @Override void buildFinished(SRunningBuild sRunningBuild); @Override void buildInterrupted(SRunningBuild sRunningBuild); @Override void beforeBuildFinish(SRunningBuild sRunningBuild); @Deprecated /** This method has been removed from the TeamCity API as of version 7.1 * * @param sBuildType * @param responsibilityInfoOld * @param responsibilityInfoNew * @param isUserAction */ void responsibleChanged(@NotNull SBuildType sBuildType, 
    							   @NotNull ResponsibilityInfo responsibilityInfoOld, 
    							   @NotNull ResponsibilityInfo responsibilityInfoNew, 
    							   boolean isUserAction); @Override void responsibleChanged(SProject project,
			Collection<TestName> testNames, ResponsibilityEntry entry,
			boolean isUserAction); @Override void responsibleChanged(SProject project, TestNameResponsibilityEntry oldTestNameResponsibilityEntry, TestNameResponsibilityEntry newTestNameResponsibilityEntry, boolean isUserAction); @Override void responsibleChanged(@NotNull SBuildType sBuildType,
            @NotNull ResponsibilityEntry responsibilityEntryOld,
            @NotNull ResponsibilityEntry responsibilityEntryNew); @Override void responsibleRemoved(SProject project, TestNameResponsibilityEntry entry); void doPost(SlackNotification notification);  }### Answer:
@Test public void testRegister() { SlackNotificationListener whl = new SlackNotificationListener(sBuildServer, settings,configSettings, manager, factory); whl.register(); verify(sBuildServer).addListener(whl); }
@Test public void testBuildChangedStatusSRunningBuildStatusStatus() throws FileNotFoundException, IOException { MockSBuildType sBuildType = new MockSBuildType("Test Build", "A Test Build", "bt1"); sBuildType.setProject(sProject); String triggeredBy = "SubVersion"; MockSRunningBuild sRunningBuild = new MockSRunningBuild(sBuildType, triggeredBy, Status.NORMAL, "Running", "TestBuild01"); when(settings.getSettings(sRunningBuild.getProjectId(), "slackNotifications")).thenReturn(projSettings); MockSProject sProject = new MockSProject("Test Project", "A test project", "project1", "ATestProject", sBuildType); sBuildType.setProject(sProject); SlackNotificationListener whl = new SlackNotificationListener(sBuildServer, settings,configSettings, manager, factory); Status oldStatus = Status.NORMAL; Status newStatus = Status.FAILURE; whl.register(); whl.buildChangedStatus(sRunningBuild, oldStatus, newStatus); verify(factory.getSlackNotification(), times(0)).post(); }