### Question:
GenericReportUnitResourceConverter extends DataSourceHolderResourceConverter<ServerReportUnitType, ClientReportUnitType> { protected String getResourceNameForReference(ResourceReference reference) { String name; final String referenceURI = reference.getReferenceURI(); Matcher matcher = Pattern.compile(EXTRACT_RESOURCE_NAME_FROM_URI_PATTERN).matcher(referenceURI); if (matcher.find()) { name = matcher.group(1); } else { throw new IllegalStateException("Invalid reference URI '" + referenceURI + "'. Resource name can't be extracted"); } return name; }    }### Answer:
@Test(expectedExceptions = IllegalStateException.class) public void getResourceNameForReference_invalidUri(){ converter.getResourceNameForReference(new ResourceReference("invalidName")); }
@Test() public void getResourceNameForReference(){ final String expectedResourceName = "testName"; final String resourceNameForReference = converter.getResourceNameForReference(new ResourceReference("/test/uri/prefix/" + expectedResourceName)); assertEquals(resourceNameForReference, expectedResourceName); }