Пример #1
0
 @Test
 public void testRemoveNonExistingProvider() {
   Service service = new Service(logger, "service1");
   service.addProvider("provider1");
   logger.reset();
   Assert.assertFalse(service.removeProvider("provider2"));
   Assert.assertTrue(logger.records().isEmpty());
 }
Пример #2
0
 @Test
 public void testAddProvider() {
   Service service = new Service(logger, "service1");
   logger.reset();
   service.addProvider("provider1");
   Assert.assertEquals(1, logger.records().size());
   Assert.assertEquals("Adding provider1 to service1\n", logger.getFileContent());
 }
Пример #3
0
 @Test
 public void testFromProviderNameListProviderAndWhiteSpace() {
   Service service = new Service(logger, "service1");
   logger.reset();
   service.fromProviderNamesList("#\n \t provider1\t\n");
   Assert.assertEquals(1, logger.records().size());
   Assert.assertEquals("provider1\n", service.toProviderNamesList());
 }
Пример #4
0
 @Test
 public void testFromProviderNameListProviderAndComment() {
   Service service = new Service(logger, "service1");
   logger.reset();
   service.fromProviderNamesList("provider1# the provider");
   Assert.assertEquals(1, logger.records().size());
   Assert.assertEquals("provider1\n", service.toProviderNamesList());
 }
Пример #5
0
 @Test
 public void testFromProviderNameListOnlyComment() {
   Service service = new Service(logger, "service1");
   logger.reset();
   service.fromProviderNamesList("#hello world");
   Assert.assertTrue(logger.records().isEmpty());
   Assert.assertEquals("", service.toProviderNamesList());
 }
Пример #6
0
 @Test
 public void testFromProviderNameListJustNewLine() {
   Service service = new Service(logger, "service1");
   logger.reset();
   service.fromProviderNamesList("\n");
   Assert.assertTrue(logger.records().isEmpty());
   Assert.assertEquals("", service.toProviderNamesList());
 }
Пример #7
0
 @Test
 public void testRemoveExistingProvider() {
   Service service = new Service(logger, "service1");
   service.addProvider("provider1");
   logger.reset();
   Assert.assertTrue(service.removeProvider("provider1"));
   Assert.assertEquals(1, logger.records().size());
   Assert.assertEquals("Removing provider1 from service1\n", logger.getFileContent());
 }
Пример #8
0
 @Test
 public void testFromProviderNameListMoreProviders() {
   Service service = new Service(logger, "service1");
   logger.reset();
   service.fromProviderNamesList("provider1\nprovider2\nprovider17\nprovider3");
   Assert.assertEquals(4, logger.records().size());
   Assert.assertEquals(
       "provider1\nprovider17\nprovider2\nprovider3\n", service.toProviderNamesList());
 }
Пример #9
0
 @Test
 public void testFromProviderNameListWhiteSpaceAndComments() {
   Service service = new Service(logger, "service1");
   logger.reset();
   service.fromProviderNamesList(
       "\n\n \n\t\n#hello world\n\n\t# comment\tmore comment\n # no comment\n");
   Assert.assertTrue(logger.records().isEmpty());
   Assert.assertEquals("", service.toProviderNamesList());
 }
Пример #10
0
 @Test
 public void testConstructorLogs() {
   new Service(logger, "service1");
   Assert.assertEquals(1, logger.records().size());
   Assert.assertEquals("Creating service1\n", logger.getFileContent());
 }