Skip to content

Commit

Permalink
Satisfy codacy's demands
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajay Kannan committed Feb 25, 2016
1 parent ee78b22 commit f852021
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ public abstract static class Builder<R, B extends Builder<R, B>> {
private String etag;
private Integer version;

/**
* Constructor for IAM Policy builder.
*/
protected Builder() {}

/**
Expand Down
45 changes: 20 additions & 25 deletions gcloud-java-core/src/test/java/com/google/gcloud/IdentityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;

import org.junit.Test;

Expand Down Expand Up @@ -48,48 +47,44 @@ public void testAllAuthenticatedUsers() {
public void testUser() {
assertEquals(Identity.Type.USER, USER.type());
assertEquals("abc@gmail.com", USER.id());
try {
Identity.user(null);
fail("Should have thrown exception due to null email address.");
} catch (NullPointerException e) {
// expected
}
}

@Test(expected=NullPointerException.class)
public void testUserNullEmail() {
Identity.user(null);
}

@Test
public void testServiceAccount() {
assertEquals(Identity.Type.SERVICE_ACCOUNT, SERVICE_ACCOUNT.type());
assertEquals("service-account@gmail.com", SERVICE_ACCOUNT.id());
try {
Identity.serviceAccount(null);
fail("Should have thrown exception due to null email address.");
} catch (NullPointerException e) {
// expected
}
}

@Test(expected=NullPointerException.class)
public void testServiceAccountNullEmail() {
Identity.serviceAccount(null);
}

@Test
public void testGroup() {
assertEquals(Identity.Type.GROUP, GROUP.type());
assertEquals("group@gmail.com", GROUP.id());
try {
Identity.group(null);
fail("Should have thrown exception due to null email address.");
} catch (NullPointerException e) {
// expected
}
}

@Test(expected=NullPointerException.class)
public void testGroupNullEmail() {
Identity.group(null);
}

@Test
public void testDomain() {
assertEquals(Identity.Type.DOMAIN, DOMAIN.type());
assertEquals("google.com", DOMAIN.id());
try {
Identity.domain(null);
fail("Should have thrown exception due to null domain.");
} catch (NullPointerException e) {
// expected
}
}

@Test(expected = NullPointerException.class)
public void testDomainNullId() {
Identity.domain(null);
}

@Test
Expand Down

0 comments on commit f852021

Please sign in to comment.