File tree Expand file tree Collapse file tree
google-cloud-clients/google-cloud-core/src
main/java/com/google/cloud
test/java/com/google/cloud Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ public String strValue() {
255255 * policy identities to {@code Identity} objects.
256256 */
257257 public static Identity valueOf (String identityStr ) {
258- String [] info = identityStr .split (":" );
258+ String [] info = identityStr .split (":" , 2 );
259259 Type type = Type .valueOf (CaseFormat .LOWER_CAMEL .to (CaseFormat .UPPER_UNDERSCORE , info [0 ]));
260260 if (info .length == 1 ) {
261261 return new Identity (type , null );
Original file line number Diff line number Diff line change @@ -141,16 +141,18 @@ public void testValueOfEmpty() {
141141 Identity .valueOf ("" );
142142 }
143143
144- @ Test (expected = IllegalArgumentException .class )
145- public void testValueOfThreePart () {
146- Identity .valueOf ("a:b:c" );
147- }
148-
149144 @ Test
150145 public void testUnrecognizedToString () {
151146 assertEquals ("a:b" , Identity .valueOf ("a:b" ).strValue ());
152147 }
153148
149+ @ Test
150+ public void testValueOfThreePart () {
151+ Identity identity = Identity .valueOf ("a:b:c" );
152+ assertEquals ("A" , identity .getType ().name ());
153+ assertEquals ("b:c" , identity .getValue ());
154+ }
155+
154156 private void compareIdentities (Identity expected , Identity actual ) {
155157 assertEquals (expected , actual );
156158 assertEquals (expected .getType (), actual .getType ());
You can’t perform that action at this time.
0 commit comments