TypesHandler implements Types { @Override public void addTypes(NamedResource individual, URI context, Set<URI> types) { final List<Statement> statements = generateStatementsForTypes(individual, types); connector.add(statements, context != null ? context.toString() : null); } TypesHandler(StorageConnector connector, InferredStorageConnector inferenceConnector); @Override Set<Axiom<URI>> getTypes(NamedResource individual, URI context, boolean includeInferred); @Override void addTypes(NamedResource individual, URI context, Set<URI> types); @Override void removeTypes(NamedResource individual, URI context, Set<URI> types);  }
@Test public void addTypesInsertsStatementsIntoStorage() { final Set<String> types = generateTypes(); handler.addTypes(SUBJECT, null, types.stream().map(URI::create).collect(Collectors.toSet())); final ArgumentCaptor<List> captor = ArgumentCaptor.forClass(List.class); verify(connectorMock).add(captor.capture(), eq(null)); verifyTypesStatements(types, captor.getValue()); }
@Test public void addTypesInsertsStatementsIntoStorageContext() { final Set<String> types = generateTypes(); final URI context = Generator.generateUri(); handler.addTypes(SUBJECT, context, types.stream().map(URI::create).collect(Collectors.toSet())); final ArgumentCaptor<List> captor = ArgumentCaptor.forClass(List.class); verify(connectorMock).add(captor.capture(), eq(context.toString())); verifyTypesStatements(types, captor.getValue()); }