@Test public void map_withPredicateObjectMappers_callsEveryPredicateObjectMapper() throws Exception { EvaluateExpression evaluator = null; SimpleValueFactory f = SimpleValueFactory.getInstance(); IRI subjectIRI = f.createIRI("http: when(subjectGenerator.apply(evaluator)) .thenReturn(ImmutableList.of(subjectIRI)); PredicateObjectMapper mockMapper1 = mock(PredicateObjectMapper.class); PredicateObjectMapper mockMapper2 = mock(PredicateObjectMapper.class); PredicateObjectMapper mockMapper3 = mock(PredicateObjectMapper.class); PredicateObjectMapper mockMapper4 = mock(PredicateObjectMapper.class); Set<PredicateObjectMapper> predObjMappers = ImmutableSet.of(mockMapper1, mockMapper2, mockMapper3, mockMapper4); Model model = new ModelBuilder().build(); SubjectMapper s = new SubjectMapper(subjectGenerator, ImmutableSet.of(), ImmutableSet.of(), predObjMappers); s.map(model, evaluator); predObjMappers.forEach( mapper -> verify(mapper) .map(model, evaluator, subjectIRI, ImmutableSet.of())); }
Optional<Resource> map(Model model, EvaluateExpression evaluate) { LOG.debug("Determining subjects ..."); List<Resource> subject = generator.apply(evaluate); LOG.debug("Determined subjects {}", subject); return subject.stream().findFirst().map(s -> mapSubject(s, model, evaluate)); }
SubjectMapper { Optional<Resource> map(Model model, EvaluateExpression evaluate) { LOG.debug("Determining subjects ..."); List<Resource> subject = generator.apply(evaluate); LOG.debug("Determined subjects {}", subject); return subject.stream().findFirst().map(s -> mapSubject(s, model, evaluate)); } }
SubjectMapper { Optional<Resource> map(Model model, EvaluateExpression evaluate) { LOG.debug("Determining subjects ..."); List<Resource> subject = generator.apply(evaluate); LOG.debug("Determined subjects {}", subject); return subject.stream().findFirst().map(s -> mapSubject(s, model, evaluate)); } SubjectMapper(
		TermGenerator<Resource> generator,
		Set<TermGenerator<IRI>> graphGenerators,
		Set<IRI> classes,
		Set<PredicateObjectMapper> predicateObjectMappers
	); }
SubjectMapper { Optional<Resource> map(Model model, EvaluateExpression evaluate) { LOG.debug("Determining subjects ..."); List<Resource> subject = generator.apply(evaluate); LOG.debug("Determined subjects {}", subject); return subject.stream().findFirst().map(s -> mapSubject(s, model, evaluate)); } SubjectMapper(
		TermGenerator<Resource> generator,
		Set<TermGenerator<IRI>> graphGenerators,
		Set<IRI> classes,
		Set<PredicateObjectMapper> predicateObjectMappers
	);  }
SubjectMapper { Optional<Resource> map(Model model, EvaluateExpression evaluate) { LOG.debug("Determining subjects ..."); List<Resource> subject = generator.apply(evaluate); LOG.debug("Determined subjects {}", subject); return subject.stream().findFirst().map(s -> mapSubject(s, model, evaluate)); } SubjectMapper(
		TermGenerator<Resource> generator,
		Set<TermGenerator<IRI>> graphGenerators,
		Set<IRI> classes,
		Set<PredicateObjectMapper> predicateObjectMappers
	);   }