@Override public boolean equals(Object obj) { if (!(obj instanceof Identity)) { return false; } Identity other = (Identity) obj; return Objects.equals(value, other.getValue()) && Objects.equals(type, other.getType()); }
@Test public void testProjectViewer() { assertEquals(Identity.Type.PROJECT_VIEWER, PROJECT_VIEWER.getType()); assertEquals("my-sample-project", PROJECT_VIEWER.getValue()); }
@Test public void testAllUsers() { assertEquals(Identity.Type.ALL_USERS, ALL_USERS.getType()); assertNull(ALL_USERS.getValue()); }
@Test public void testAllAuthenticatedUsers() { assertEquals(Identity.Type.ALL_AUTHENTICATED_USERS, ALL_AUTH_USERS.getType()); assertNull(ALL_AUTH_USERS.getValue()); }
@Test public void testServiceAccount() { assertEquals(Identity.Type.SERVICE_ACCOUNT, SERVICE_ACCOUNT.getType()); assertEquals("service-account@gmail.com", SERVICE_ACCOUNT.getValue()); }
@Test public void testUser() { assertEquals(Identity.Type.USER, USER.getType()); assertEquals("abc@gmail.com", USER.getValue()); }
@Test public void testGroup() { assertEquals(Identity.Type.GROUP, GROUP.getType()); assertEquals("group@gmail.com", GROUP.getValue()); }
@Test public void testDomain() { assertEquals(Identity.Type.DOMAIN, DOMAIN.getType()); assertEquals("google.com", DOMAIN.getValue()); }
@Test public void testProjectOwner() { assertEquals(Identity.Type.PROJECT_OWNER, PROJECT_OWNER.getType()); assertEquals("my-sample-project", PROJECT_OWNER.getValue()); }
@Test public void testProjectEditor() { assertEquals(Identity.Type.PROJECT_EDITOR, PROJECT_EDITOR.getType()); assertEquals("my-sample-project", PROJECT_EDITOR.getValue()); }
@Override public boolean equals(Object obj) { if (!(obj instanceof Identity)) { return false; } Identity other = (Identity) obj; return Objects.equals(value, other.getValue()) && Objects.equals(type, other.getType()); }