### Question:
IndividualHelperImpl implements IndividualHelper { @Override public Set<URI> types() { Property property = this.individual.property(RDF.TYPE.as(URI.class)); if(property==null) { return Collections.emptySet(); } TypeCollector collector = new TypeCollector(); for(Value value:property) { value.accept(collector); } return collector.collectedTypes(); } IndividualHelperImpl(Individual<?,?> individual); @Override Set<URI> types(); @Override PropertyHelper property(URI propertyId); @Override PropertyHelper property(String propertyId); @Override PropertyHelper property(Term property);  }### Answer:
@Test public void testTypes$empty() { DataSet data=exampleDataSet(); Individual<?,?> individual = data.individualOfId(BLANK_NODE); IndividualHelperImpl sut = new IndividualHelperImpl(individual); assertThat(sut.types(),hasSize(0)); }
@Test public void testTypes$found() { DataSet data=exampleDataSet(); Individual<?,?> individual = data.individualOfId(BLANK_NODE); IndividualHelperImpl sut = new IndividualHelperImpl(individual); ExternalIndividual foundIndividual = data.individual(LDP.CONTAINER.as(URI.class), ExternalIndividual.class); individual.addValue(RDF.TYPE.as(URI.class), foundIndividual); assertThat(sut.types(),contains(LDP.CONTAINER.as(URI.class))); }
@Test public void testTypes$discardLocalIndividual() { DataSet data=exampleDataSet(); Individual<?,?> individual = data.individualOfId(BLANK_NODE); IndividualHelperImpl sut = new IndividualHelperImpl(individual); individual.addValue(RDF.TYPE.as(URI.class), individual); assertThat(sut.types(),hasSize(0)); }
@Test public void testTypes$discardNewIndividual() { DataSet data=exampleDataSet(); Individual<?,?> individual = data.individualOfId(BLANK_NODE); IndividualHelperImpl sut = new IndividualHelperImpl(individual); NewIndividual foundIndividual = data.individual(URI.create(""), NewIndividual.class); individual.addValue(RDF.TYPE.as(URI.class), foundIndividual); assertThat(sut.types(),hasSize(0)); }
@Test public void testTypes$discardManagedIndividual() { DataSet data=exampleDataSet(); Individual<?,?> individual = data.individualOfId(BLANK_NODE); IndividualHelperImpl sut = new IndividualHelperImpl(individual); ManagedIndividual foundIndividual = data.individual(ManagedIndividualId.createId(RESOURCE_NAME, MANAGER_ID), ManagedIndividual.class); individual.addValue(RDF.TYPE.as(URI.class), foundIndividual); assertThat(sut.types(),hasSize(0)); }
@Test public void testTypes$discardRelativeIndividual() { DataSet data=exampleDataSet(); Individual<?,?> individual = data.individualOfId(BLANK_NODE); IndividualHelperImpl sut = new IndividualHelperImpl(individual); RelativeIndividual foundIndividual = data.individual(RelativeIndividualId.createId(ManagedIndividualId.createId(RESOURCE_NAME, MANAGER_ID),RELATIVE_PATH), RelativeIndividual.class); individual.addValue(RDF.TYPE.as(URI.class), foundIndividual); assertThat(sut.types(),hasSize(0)); }
@Test public void testTypes$discardLiteral() { DataSet data=exampleDataSet(); Individual<?,?> individual = data.individualOfId(BLANK_NODE); IndividualHelperImpl sut = new IndividualHelperImpl(individual); individual.addValue(RDF.TYPE.as(URI.class), Literals.of("plain literal")); assertThat(sut.types(),hasSize(0)); }