### Question:
BaseMetadataDatatype extends BaseOpenmrsDatatype<T> { @Override public Summary doGetTextSummary(T typedValue) { return new CustomDatatype.Summary(typedValue.getName(), true); }  @Override Summary doGetTextSummary(T typedValue);  }### Answer:
@Test public void doGetTextSummary_shouldUseTheNameInSummaryInstance() { OpenmrsMetadata location = new Location(); String expectedSummary = "some summary"; location.setName(expectedSummary); BaseMetadataDatatype datatype = new MockLocationDatatype(); CustomDatatype.Summary summary = datatype.doGetTextSummary(location); Assert.assertEquals(expectedSummary, summary.getSummary()); Assert.assertEquals(true, summary.isComplete()); }
@Test public void doGetTextSummary_shouldUseTheNameInSummaryInstance() throws Exception { OpenmrsMetadata location = new Location(); String expectedSummary = "some summary"; location.setName(expectedSummary); BaseMetadataDatatype datatype = new MockLocationDatatype(); CustomDatatype.Summary summary = datatype.doGetTextSummary(location); Assert.assertEquals(expectedSummary, summary.getSummary()); Assert.assertEquals(true, summary.isComplete()); }