@Test public void testInvalidCrnDueToService() { thrown.expect(CrnParseException.class); Crn.fromString(invalidCrnService); }
@Nullable public static Crn fromString(String input) { checkNotNull(input); Matcher matcher = CRN_PATTERN.matcher(input); if (!matcher.matches()) { return null; } String region = matcher.group(3); if (!Region.US_WEST_1.name.equals(region)) { throw new CrnParseException(String.format("%s is not a supported region", region)); } return new Crn.Builder() .setPartition(Partition.safeFromString(matcher.group(1))) .setService(Service.safeFromString(matcher.group(2))) .setAccountId(matcher.group(4)) .setResourceType(ResourceType.fromString(matcher.group(5))) .setResource(matcher.group(6)) .build(); }
Crn { @Nullable public static Crn fromString(String input) { checkNotNull(input); Matcher matcher = CRN_PATTERN.matcher(input); if (!matcher.matches()) { return null; } String region = matcher.group(3); if (!Region.US_WEST_1.name.equals(region)) { throw new CrnParseException(String.format("%s is not a supported region", region)); } return new Crn.Builder() .setPartition(Partition.safeFromString(matcher.group(1))) .setService(Service.safeFromString(matcher.group(2))) .setAccountId(matcher.group(4)) .setResourceType(ResourceType.fromString(matcher.group(5))) .setResource(matcher.group(6)) .build(); } }
Crn { @Nullable public static Crn fromString(String input) { checkNotNull(input); Matcher matcher = CRN_PATTERN.matcher(input); if (!matcher.matches()) { return null; } String region = matcher.group(3); if (!Region.US_WEST_1.name.equals(region)) { throw new CrnParseException(String.format("%s is not a supported region", region)); } return new Crn.Builder() .setPartition(Partition.safeFromString(matcher.group(1))) .setService(Service.safeFromString(matcher.group(2))) .setAccountId(matcher.group(4)) .setResourceType(ResourceType.fromString(matcher.group(5))) .setResource(matcher.group(6)) .build(); } Crn(Partition partition,
            Service service,
            Region region,
            String accountId,
            ResourceType resourceType,
            String resource); }
Crn { @Nullable public static Crn fromString(String input) { checkNotNull(input); Matcher matcher = CRN_PATTERN.matcher(input); if (!matcher.matches()) { return null; } String region = matcher.group(3); if (!Region.US_WEST_1.name.equals(region)) { throw new CrnParseException(String.format("%s is not a supported region", region)); } return new Crn.Builder() .setPartition(Partition.safeFromString(matcher.group(1))) .setService(Service.safeFromString(matcher.group(2))) .setAccountId(matcher.group(4)) .setResourceType(ResourceType.fromString(matcher.group(5))) .setResource(matcher.group(6)) .build(); } Crn(Partition partition,
            Service service,
            Region region,
            String accountId,
            ResourceType resourceType,
            String resource); Partition getPartition(); Service getService(); Region getRegion(); String getAccountId(); ResourceType getResourceType(); String getResource(); String getUserId(); @Override String toString(); @Nullable static Crn fromString(String input); static Crn safeFromString(String input); static boolean isCrn(@Nullable String input); @Override int hashCode(); @Override boolean equals(Object object); static Builder builder(); }
Crn { @Nullable public static Crn fromString(String input) { checkNotNull(input); Matcher matcher = CRN_PATTERN.matcher(input); if (!matcher.matches()) { return null; } String region = matcher.group(3); if (!Region.US_WEST_1.name.equals(region)) { throw new CrnParseException(String.format("%s is not a supported region", region)); } return new Crn.Builder() .setPartition(Partition.safeFromString(matcher.group(1))) .setService(Service.safeFromString(matcher.group(2))) .setAccountId(matcher.group(4)) .setResourceType(ResourceType.fromString(matcher.group(5))) .setResource(matcher.group(6)) .build(); } Crn(Partition partition,
            Service service,
            Region region,
            String accountId,
            ResourceType resourceType,
            String resource); Partition getPartition(); Service getService(); Region getRegion(); String getAccountId(); ResourceType getResourceType(); String getResource(); String getUserId(); @Override String toString(); @Nullable static Crn fromString(String input); static Crn safeFromString(String input); static boolean isCrn(@Nullable String input); @Override int hashCode(); @Override boolean equals(Object object); static Builder builder();  }