SourceService implements ISourceService { @Override public boolean deleteSource(Source source) { int sourceId = source.getId(); if (exits(sourceId)) { getSourceManager().removeSource(sourceId); return getSource(sourceId) == null; } return false; }  @Override int count(); @Override Source createSource(String url, String username, String password, Integer maxDownloads); @Override Source getSource(int sourceId); @Override Source getSource(SynchronizerSource synchronizerSource); @Override List<Source> getSource(List<SynchronizerSource> synchronizerSources); @Override boolean updateSource(Source source); @Override boolean deleteSource(Source source); @Override List<Source> list(); @Override List<Source> sortSources(List<Source> sources); @Override Source getBestSource(List<Source> sources);  }
@Test(dependsOnMethods = {"updateSource"}) public void deleteSource() { int sourceId = 4; int expectedCount = service.count() - 1; Source source = new Source(); source.setId(sourceId); Assert.assertTrue(service.deleteSource(source)); Assert.assertEquals(service.count(), expectedCount); Assert.assertNull(service.getSource(sourceId)); Assert.assertFalse(service.deleteSource(source)); }