Fix NPE in tests

BackupRef.get() is failing because the static cfg member is null.

As a workaround, make getTimestampBranch public and use that
directly. Since there are no tests for non-timestamp implementation
yet anyway, this should be OK.

Tests for the non-timestamp implementation, and correction in the
implementation of get() can be added in a follow-up commit.

Change-Id: I644db55f5c1cb043479ca3ea9b10b3b3c642a069
diff --git a/src/main/java/com/googlesource/gerrit/plugins/refprotection/BackupRef.java b/src/main/java/com/googlesource/gerrit/plugins/refprotection/BackupRef.java
index 1f257bf..33a642a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/refprotection/BackupRef.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/refprotection/BackupRef.java
@@ -183,7 +183,7 @@
     }
   }
 
-  private static String getTimestampBranch(String refName) {
+  static String getTimestampBranch(String refName) {
     if (refName.startsWith(R_HEADS) || refName.startsWith(R_TAGS)) {
       return String.format("%s-%s",
           R_BACKUPS + refName.replaceFirst(R_REFS, ""),
diff --git a/src/test/java/com/googlesource/gerrit/plugins/refprotection/BackupRefNameTest.java b/src/test/java/com/googlesource/gerrit/plugins/refprotection/BackupRefNameTest.java
index d38f3b5..168a723 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/refprotection/BackupRefNameTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/refprotection/BackupRefNameTest.java
@@ -8,14 +8,14 @@
 
   @Test
   public void backupTimestampRefNameForTag() throws Exception {
-    String name = BackupRef.get(null, "refs/tags/v1.0");
+    String name = BackupRef.getTimestampBranch("refs/tags/v1.0");
     String expected_prefix = BackupRef.R_BACKUPS + "tags/v1.0-";
     assertThat(name).startsWith(expected_prefix);
   }
 
   @Test
   public void backupTimestampRefNameForBranch() throws Exception {
-    String name = BackupRef.get(null, "refs/heads/master");
+    String name = BackupRef.getTimestampBranch("refs/heads/master");
     String expected_prefix = BackupRef.R_BACKUPS + "heads/master-";
     assertThat(name).startsWith(expected_prefix);
   }
@@ -23,6 +23,6 @@
   @Test
   public void backupTimestampRefNameForUnsupportedNamespace() throws Exception {
     String ref = "refs/changes/45/12345/1";
-    assertThat(BackupRef.get(null, ref)).isEqualTo(ref);
+    assertThat(BackupRef.getTimestampBranch(ref)).isEqualTo(ref);
   }
 }