### Question:
ResourceHashModel implements TemplateHashModelEx, TemplateScalarModel, ResourceTemplate { @Override public TemplateCollectionModel values() throws TemplateModelException { ArrayList<String> list = new ArrayList<String>(); StmtIterator iterator = resource.listProperties(); while (iterator.hasNext()) { RDFNode node = iterator.next().getObject(); if (node.isLiteral()) { list.add(((Literal) node).getLexicalForm()); } else if (node.isResource()) { list.add(((Resource) node).getURI()); } } return new SimpleCollection(list); } ResourceHashModel(Resource resource); @Override int size(); @Override TemplateCollectionModel keys(); @Override TemplateCollectionModel values(); @Override TemplateModel get(String s); @Override boolean isEmpty(); @Override String getAsString(); @Override Resource getResource(); final static String INVALID_URL; }### Answer:
@Test public void testValues() throws TemplateModelException { ArrayList<String> valueList = new ArrayList<String>(); for (TemplateModelIterator i = resourceHashModel.values().iterator(); i.hasNext();) { valueList.add((i.next()).toString()); } assertEquals("Unexpected size", KEY_SIZE, valueList.size()); assertTrue("Expected value: " + testStringLiteral, valueList.contains(testStringLiteral)); assertTrue("Expected value: " + testIntegerLiteral, valueList.contains(String.valueOf(testIntegerLiteral))); assertTrue("Expected value: " + testDoubleLiteral, valueList.contains(String.valueOf(testDoubleLiteral))); assertTrue("Expected value: " + secondUri, valueList.contains(String.valueOf(secondUri))); }