Source:
<code>public void evaluate_constantSubject() throws Exception { <START> final MongoClient client = MockMongoSingleton.getInstance(); <END> final EntityStorage storage = new MongoEntityStorage(client, "testDB"); final ValueFactory vf = ValueFactoryImpl.getInstance(); final RyaURI subject = new RyaURI("urn:SSN:111-11-1111"); final Entity entity = Entity.builder() .setSubject(subject) .setExplicitType(PERSON_TYPE.getId()) .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:age"), RdfToRyaConversions.convertLiteral(vf.createLiteral(20)))) .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:eye"), RdfToRyaConversions.convertLiteral(vf.createLiteral("blue")))) .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:name"), RdfToRyaConversions.convertLiteral(vf.createLiteral("Bob")))) .build(); storage.create(entity); final List<StatementPattern> patterns = getSPs( "SELECT * WHERE { " + "<urn:SSN:111-11-1111> <" + RDF.TYPE + "> <urn:person> ."+ "<urn:SSN:111-11-1111> <urn:age> ?age . " + "<urn:SSN:111-11-1111> <urn:eye> ?eye . " + "<urn:SSN:111-11-1111> <urn:name> ?name . " + "}"); final EntityQueryNode node = new EntityQueryNode(PERSON_TYPE, patterns, storage); final CloseableIteration<BindingSet, QueryEvaluationException> rez = node.evaluate(new MapBindingSet()); final MapBindingSet expected = new MapBindingSet(); expected.addBinding("age", vf.createLiteral("20")); expected.addBinding("eye", vf.createLiteral("blue")); expected.addBinding("name", vf.createLiteral("Bob")); while(rez.hasNext()) { assertEquals(expected, rez.next()); break; } }</code><technical_language>I accessing MongoClient MongoITBase (instead of MockMongoSingleton.getInstance()), @Rule I mentioned</technical_language>

Target:
public void evaluate_constantSubject() throws Exception { final EntityStorage storage = new MongoEntityStorage(super.getMongoClient(), "testDB"); final ValueFactory vf = ValueFactoryImpl.getInstance(); final RyaURI subject = new RyaURI("urn:SSN:111-11-1111"); final Entity entity = Entity.builder() .setSubject(subject) .setExplicitType(PERSON_TYPE.getId()) .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:age"), RdfToRyaConversions.convertLiteral(vf.createLiteral(20)))) .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:eye"), RdfToRyaConversions.convertLiteral(vf.createLiteral("blue")))) .setProperty(PERSON_TYPE.getId(), new Property(new RyaURI("urn:name"), RdfToRyaConversions.convertLiteral(vf.createLiteral("Bob")))) .build(); storage.create(entity); final List<StatementPattern> patterns = getSPs( "SELECT * WHERE { " + "<urn:SSN:111-11-1111> <" + RDF.TYPE + "> <urn:person> ."+ "<urn:SSN:111-11-1111> <urn:age> ?age . " + "<urn:SSN:111-11-1111> <urn:eye> ?eye . " + "<urn:SSN:111-11-1111> <urn:name> ?name . " + "}"); final EntityQueryNode node = new EntityQueryNode(PERSON_TYPE, patterns, storage); final CloseableIteration<BindingSet, QueryEvaluationException> rez = node.evaluate(new MapBindingSet()); final MapBindingSet expected = new MapBindingSet(); expected.addBinding("age", vf.createLiteral("20")); expected.addBinding("eye", vf.createLiteral("blue")); expected.addBinding("name", vf.createLiteral("Bob")); while(rez.hasNext()) { assertEquals(expected, rez.next()); break; } }