### Question:
CommonNodeWrapper extends RDFNodeWrapper { public Resource getResource( Object p ) { Resource r = null; if (isResource()) { com.epimorphics.rdfutil.RDFNodeWrapper n = getPropertyValue( p ); if (n != null && n.isResource()) { r = n.asResource(); } } return r; } CommonNodeWrapper( ModelWrapper mw, RDFNode node );  CommonNodeWrapper( Page page, RDFNode node ); Page page(); int getInt( Object p, int def ); Resource getResource( Object p ); boolean isXmlLiteral(); @Override String getName();  }### Answer:
@Test public void testGetResource() { String ns = "http: ModelWrapper mw = modelWrapperFixture(); Resource foo = mw.getModel().getResource( ns + "foo" ); CommonNodeWrapper n = new CommonNodeWrapper( mw, foo ); assertEquals( ResourceFactory.createResource( ns + "bar" ), n.getResource( mw.getModel().getProperty( ns+"r" ) ) ); assertEquals( ResourceFactory.createResource( ns + "bar" ), n.getResource( ns+"r" ) ); assertEquals( ResourceFactory.createResource( ns + "bar" ), n.getResource( "example:r" ) ); assertNull( n.getResource( "example:not-here" ) ); CommonNodeWrapper l = new CommonNodeWrapper( mw, mw.getModel().createLiteral( "kermit" ) ); assertNull( l.getResource( "example:p" ) ); assertNull( n.getResource( "example:p" )); }