### Question:
ComplianceV2UriStrategy implements UriStrategy { @Override public URI createStreamUri(final String account, final String streamName, final Integer backfill) { if (account == null || account.trim().isEmpty()) { throw new IllegalArgumentException("The account cannot be null or empty"); } if (streamName == null || streamName.trim().isEmpty()) { throw new IllegalArgumentException("The streamName cannot be null or empty"); } if(backfill != null) { throw new IllegalArgumentException("Backfill is not supported at the compliance"); } return URI.create(String.format(Locale.ENGLISH, BASE_GNIP_STREAM_URI_V2, account.trim(), streamName.trim(), partition)); } ComplianceV2UriStrategy(final int partition); @Override URI createStreamUri(final String account, final String streamName, final Integer backfill); @Override URI createRulesUri(final String account, final String streamName); @Override URI createRulesDeleteUri(final String account, final String streamName); @Override URI createRulesValidationUri(final String account, final String streamName); @Override String getHttpMethodForRulesDelete(); String getPartition(); static final String BASE_GNIP_STREAM_URI_V2; static final String BASE_GNIP_RULES_URI; static final String GNIP_RULE_VALIDATION_URI; }### Answer:
@Test public void supportsPartitionsBetweenOneAndEight() { for (int partitionNumber = 1; partitionNumber <= 8; partitionNumber++) { final ComplianceV2UriStrategy strategy = new ComplianceV2UriStrategy(partitionNumber); final String streamUri = strategy.createStreamUri("my-account", "my-stream").toString(); assertEquals(Integer.toString(partitionNumber), streamUri.substring(streamUri.length() - 1, streamUri.length())); } for (final int partitionNumber : new int[]{0, 9, 13}) { try { new ComplianceV2UriStrategy(partitionNumber); fail("Should have thrown IllegalArgumentException for partition: " + partitionNumber); } catch (final IllegalArgumentException iae) { } } }