@Test
 public void testIsNbRepositoryRepo() {
   assertFalse(
       BugtrackingUtil.isNbRepository(
           TestKit.getRepository(new BUTestRepository("enembenem")).getUrl()));
   assertTrue(BugtrackingUtil.isNbRepository("https://netbeans.org/bugzilla"));
 }
 private void urlTest(String protocol, String[] hosts, boolean fail) {
   for (String url : hosts) {
     if (!fail && !BugtrackingUtil.isNbRepository(protocol + url)) {
       fail(protocol + url + " is expected to be a netbeans bugzilla url");
     } else if (fail && BugtrackingUtil.isNbRepository(protocol + url)) {
       fail(protocol + url + " isn't expected to be a netbeans bugzilla url");
     }
   }
 }
 @Test
 public void testIsNbRepositoryStringUrl() {
   assertFalse(BugtrackingUtil.isNbRepository("enembenem"));
   urlTest("http://", VALID_HOSTS, false);
   urlTest("https://", VALID_HOSTS, false);
   urlTest("http://", INVALID_HOSTS, true);
   urlTest("https://", INVALID_HOSTS, true);
 }
Пример #4
0
 private void emptyStorage()
     throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException,
         InvocationTargetException, NoSuchFieldException {
   File f = getStorageRootFile();
   BugtrackingUtil.deleteRecursively(f);
   Field field = IssueStorage.class.getDeclaredField("storage");
   field.setAccessible(true);
   field.set(IssueStorage.getInstance(), f);
 }
 @Test(expected = NullPointerException.class)
 public void testIsNbRepositoryRepoNullUrl() {
   assertFalse(
       BugtrackingUtil.isNbRepository(TestKit.getRepository(new BUTestRepository(null)).getUrl()));
 }
 @Test(expected = NullPointerException.class)
 public void testIsNbRepositoryNullRepo() {
   BUTestRepository repo = null;
   assertFalse(BugtrackingUtil.isNbRepository(TestKit.getRepository(repo).getUrl()));
 }
 @Test(expected = NullPointerException.class)
 public void testIsNbRepositoryNullString() {
   String url = null;
   BugtrackingUtil.isNbRepository(url);
 }