DbCredential { public static AvailableRoles getRole(final String roleParam) { if(AvailableRoles.LICENSE_CHECKER.toString().equalsIgnoreCase(roleParam)){ return AvailableRoles.LICENSE_CHECKER; } if(AvailableRoles.DEPENDENCY_NOTIFIER.toString().equalsIgnoreCase(roleParam)){ return AvailableRoles.DEPENDENCY_NOTIFIER; } if(AvailableRoles.DATA_UPDATER.toString().equalsIgnoreCase(roleParam)){ return AvailableRoles.DATA_UPDATER; } if(AvailableRoles.DATA_DELETER.toString().equalsIgnoreCase(roleParam)){ return AvailableRoles.DATA_DELETER; } if(AvailableRoles.ARTIFACT_CHECKER.toString().equalsIgnoreCase(roleParam)){ return AvailableRoles.ARTIFACT_CHECKER; } if(AvailableRoles.LICENSE_SETTER.toString().equalsIgnoreCase(roleParam)){ return AvailableRoles.LICENSE_SETTER; } return null; }  void setDataModelVersion(final String newVersion); String getDataModelVersion(); String getUser(); void setUser(final String user); String getPassword(); void setPassword(final String password); List<AvailableRoles> getRoles(); void setRoles(final List<AvailableRoles> roles); void addRole(final AvailableRoles role); void removeRole(final AvailableRoles role); boolean isHealthy(); static AvailableRoles getRole(final String roleParam); static final String DATA_MODEL_VERSION; static final String PASSWORD_FIELD; static final String ROLES_FIELD; }
@Test public void checkGetRole(){ assertEquals(null, DbCredential.getRole("wrongRole")); assertEquals(AvailableRoles.ARTIFACT_CHECKER, DbCredential.getRole("artifact_checker")); assertEquals(AvailableRoles.DATA_DELETER, DbCredential.getRole("DATA_DELETER")); assertEquals(AvailableRoles.DATA_UPDATER, DbCredential.getRole("DATA_updater")); assertEquals(AvailableRoles.DEPENDENCY_NOTIFIER, DbCredential.getRole("dependency_NOTIFIER")); assertEquals(AvailableRoles.LICENSE_CHECKER, DbCredential.getRole("license_checker")); assertEquals(AvailableRoles.LICENSE_SETTER, DbCredential.getRole("license_setter")); }