### Question:
PropertyHelperImpl implements PropertyHelper { @Override public <T> T firstValue(final Class<? extends T> aClazz) { Property property=getProperty(); if(property==null) { return null; } LiteralValueExtractor<T> extractor =LiteralValueExtractor.newInstance(aClazz); for(Value value:property) { value.accept(extractor); if(extractor.isAvailable()) { break; } } return extractor.getValue(); } PropertyHelperImpl(URI propertyId, Individual<?,?> individual); @Override T firstValue(final Class<? extends T> aClazz); @Override IndividualHelper firstIndividual(); @Override T firstIndividual(final Class<? extends S> clazz); @Override IndividualPropertyHelper withLiteral(Object rawValue); @Override IndividualPropertyHelper withIndividual(Name<?> id); @Override IndividualPropertyHelper withIndividual(Name<?> id, String managerId); @Override IndividualPropertyHelper withIndividual(Name<?> id, String managerId, URI path); @Override IndividualPropertyHelper withIndividual(Name<?> id, String managerId, String path); @Override IndividualPropertyHelper withIndividual(URI id); @Override IndividualPropertyHelper withIndividual(String id); @Override IndividualPropertyHelper withIndividual(Term id);  }### Answer:
@Test public void testFirstValue$empty() { DataSet data=exampleDataSet(); Individual<?,?> individual = data.individualOfId(BLANK_NODE); PropertyHelperImpl sut = new PropertyHelperImpl(RDF.TYPE.as(URI.class), individual); assertThat(sut.firstValue(Integer.class),nullValue()); }
@Test public void testFirstValue$found() { DataSet data=exampleDataSet(); Individual<?,?> individual = data.individualOfId(BLANK_NODE); PropertyHelperImpl sut = new PropertyHelperImpl(URI.create(HAS_TITLE), individual); assertThat(sut.firstValue(String.class),equalTo("bnode")); }
@Test public void testFirstValue$notFound() { DataSet data=exampleDataSet(); Individual<?,?> individual = data.individualOfId(BLANK_NODE); PropertyHelperImpl sut = new PropertyHelperImpl(URI.create(HAS_TITLE), individual); assertThat(sut.firstValue(Integer.class),nullValue()); }