GitLabState { static String stateFor(String result) { result = result == null ? "" : result; String state = PENDING; if (result.equalsIgnoreCase("Passed")) { state = SUCCESS; } else if (result.equalsIgnoreCase("Failed")) { state = FAILED; } else if (result.equalsIgnoreCase("Cancelled")) { state = CANCELED; } return state; } GitLabState();   }
@Test public void checkStates() throws Exception { assertEquals("pending", GitLabState.stateFor("unknown")); assertEquals("pending", GitLabState.stateFor(null)); assertEquals("success", GitLabState.stateFor("Passed")); assertEquals("failed", GitLabState.stateFor("Failed")); assertEquals("canceled", GitLabState.stateFor("Cancelled")); }