### Question:
RadiologyReportResource extends DataDelegatingCrudResource<RadiologyReport> { @Override public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { final DelegatingResourceDescription description = new DelegatingResourceDescription(); addDefaultProperties(description); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { final DelegatingResourceDescription description = new DelegatingResourceDescription(); addDefaultProperties(description); description.addProperty("auditInfo"); description.addSelfLink(); return description; } else { return null; } }  @Override DelegatingResourceDescription getRepresentationDescription(Representation rep); @Override String getResourceVersion(); @PropertyGetter("display") String getDisplayString(RadiologyReport radiologyReport); @Override RadiologyReport getByUniqueId(String uniqueId); @Override RadiologyReport newDelegate(); @Override RadiologyReport save(RadiologyReport delegate); @Override void purge(RadiologyReport delegate, RequestContext context);  }### Answer:
@Test public void shouldReturnDefaultRepresentationGivenInstanceOfDefaultrepresentation() throws Exception { DefaultRepresentation defaultRepresentation = new DefaultRepresentation(); DelegatingResourceDescription resourceDescription = radiologyReportResource.getRepresentationDescription(defaultRepresentation); assertThat(resourceDescription.getProperties() .keySet(), contains("uuid", "radiologyOrder", "date", "principalResultsInterpreter", "status", "body", "display", "voided")); assertThat(resourceDescription.getProperties() .get("radiologyOrder") .getRep(), is(Representation.REF)); }
@Test public void shouldReturnFullRepresentationGivenInstanceOfFullrepresentation() throws Exception { FullRepresentation fullRepresentation = new FullRepresentation(); DelegatingResourceDescription resourceDescription = radiologyReportResource.getRepresentationDescription(fullRepresentation); assertThat(resourceDescription.getProperties() .keySet(), contains("uuid", "radiologyOrder", "date", "principalResultsInterpreter", "status", "body", "display", "voided", "auditInfo")); assertThat(resourceDescription.getProperties() .get("radiologyOrder") .getRep(), is(Representation.REF)); }
@Test public void shouldReturnNullForRepresentationOtherThenDefaultOrFull() throws Exception { CustomRepresentation customRepresentation = new CustomRepresentation("some"); assertThat(radiologyReportResource.getRepresentationDescription(customRepresentation), is(nullValue())); NamedRepresentation namedRepresentation = new NamedRepresentation("some"); radiologyReportResource = new RadiologyReportResource(); assertThat(radiologyReportResource.getRepresentationDescription(namedRepresentation), is(nullValue())); RefRepresentation refRepresentation = new RefRepresentation(); radiologyReportResource = new RadiologyReportResource(); assertThat(radiologyReportResource.getRepresentationDescription(refRepresentation), is(nullValue())); }