@@ -30,6 +30,9 @@ public class IdentityTest {
3030 Identity .
serviceAccount (
"[email protected] " );
3131 private static final Identity GROUP =
Identity .
group (
"[email protected] " );
3232 private static final Identity DOMAIN = Identity .domain ("google.com" );
33+ private static final Identity PROJECT_OWNER = Identity .projectOwner ("my-sample-project" );
34+ private static final Identity PROJECT_EDITOR = Identity .projectEditor ("my-sample-project" );
35+ private static final Identity PROJECT_VIEWER = Identity .projectViewer ("my-sample-project" );
3336
3437 @ Test
3538 public void testAllUsers () {
@@ -93,6 +96,39 @@ public void testDomainNullId() {
9396 Identity .domain (null );
9497 }
9598
99+ @ Test
100+ public void testProjectOwner () {
101+ assertEquals (Identity .Type .PROJECT_OWNER , PROJECT_OWNER .getType ());
102+ assertEquals ("my-sample-project" , PROJECT_OWNER .getValue ());
103+ }
104+
105+ @ Test (expected = NullPointerException .class )
106+ public void testProjectOwnerNullId () {
107+ Identity .projectOwner (null );
108+ }
109+
110+ @ Test
111+ public void testProjectEditor () {
112+ assertEquals (Identity .Type .PROJECT_EDITOR , PROJECT_EDITOR .getType ());
113+ assertEquals ("my-sample-project" , PROJECT_EDITOR .getValue ());
114+ }
115+
116+ @ Test (expected = NullPointerException .class )
117+ public void testProjectEditorNullId () {
118+ Identity .projectEditor (null );
119+ }
120+
121+ @ Test
122+ public void testProjectViewer () {
123+ assertEquals (Identity .Type .PROJECT_VIEWER , PROJECT_VIEWER .getType ());
124+ assertEquals ("my-sample-project" , PROJECT_VIEWER .getValue ());
125+ }
126+
127+ @ Test (expected = NullPointerException .class )
128+ public void testProjectViewerNullId () {
129+ Identity .projectViewer (null );
130+ }
131+
96132 @ Test
97133 public void testIdentityToAndFromPb () {
98134 compareIdentities (ALL_USERS , Identity .valueOf (ALL_USERS .strValue ()));
@@ -101,6 +137,9 @@ public void testIdentityToAndFromPb() {
101137 compareIdentities (SERVICE_ACCOUNT , Identity .valueOf (SERVICE_ACCOUNT .strValue ()));
102138 compareIdentities (GROUP , Identity .valueOf (GROUP .strValue ()));
103139 compareIdentities (DOMAIN , Identity .valueOf (DOMAIN .strValue ()));
140+ compareIdentities (PROJECT_OWNER , Identity .valueOf (PROJECT_OWNER .strValue ()));
141+ compareIdentities (PROJECT_EDITOR , Identity .valueOf (PROJECT_EDITOR .strValue ()));
142+ compareIdentities (PROJECT_VIEWER , Identity .valueOf (PROJECT_VIEWER .strValue ()));
104143 }
105144
106145 private void compareIdentities (Identity expected , Identity actual ) {
0 commit comments