RefReplicatedEvent: Move toStatusString to RefPushResult.toString

Change-Id: I7ce1221744114d5bc184efb11fda27106657e6bc
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/RefReplicatedEvent.java b/src/main/java/com/googlesource/gerrit/plugins/replication/RefReplicatedEvent.java
index 05936dd..8da1d0c 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/RefReplicatedEvent.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/RefReplicatedEvent.java
@@ -37,14 +37,10 @@
     this.project = project;
     this.ref = ref;
     this.targetNode = targetNode;
-    this.status = toStatusString(status);
+    this.status = status.toString();
     this.refStatus = refStatus;
   }
 
-  private String toStatusString(RefPushResult status) {
-    return status.name().toLowerCase().replace("_", "-");
-  }
-
   @Override
   public Project.NameKey getProjectNameKey() {
     return new Project.NameKey(project);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationState.java b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationState.java
index 9244316..27fe841 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationState.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/ReplicationState.java
@@ -172,5 +172,10 @@
      * The ref was successfully replicated.
      */
     SUCCEEDED;
+
+    @Override
+    public String toString() {
+      return name().toLowerCase().replace("_", "-");
+    }
   }
 }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStateTest.java b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStateTest.java
index 4228d75..56096c2 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStateTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/replication/ReplicationStateTest.java
@@ -19,6 +19,7 @@
 import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.resetToDefault;
 import static org.easymock.EasyMock.verify;
+import static org.junit.Assert.assertEquals;
 
 import com.googlesource.gerrit.plugins.replication.ReplicationState.RefPushResult;
 
@@ -216,4 +217,11 @@
     replicationState.markAllPushTasksScheduled();
     verify(pushResultProcessingMock);
   }
+
+  @Test
+  public void toStringRefPushResult() throws Exception {
+    assertEquals("failed", RefPushResult.FAILED.toString());
+    assertEquals("not-attempted", RefPushResult.NOT_ATTEMPTED.toString());
+    assertEquals("succeeded", RefPushResult.SUCCEEDED.toString());
+  }
 }