### Question:
ShortNameDefinitionParser implements DefinitionParser { @Override public ViewProperty getViewProperty(String definition, ViewProperty.Factory factory) { Property prop = expand(definition); return new ViewProperty.Base(prop); } ShortNameDefinitionParser(ShortnameService svc); @Override Pattern pattern(); @Override ViewProperty getViewProperty(String definition, ViewProperty.Factory factory);  }### Answer:
@Test public void viewProperty_shortName_ReturnsShortName() { when(ctx.getNameForURI(uri)).thenReturn("defn"); String name = getViewProperty().shortName(ctx); assertEquals("defn", name); }
@Test public void viewProperty_asTriple_ReturnsRelationAsTriple() { Any subject = mock(Any.class); Any object = mock(Any.class); VarSupply vars = mock(VarSupply.class); RDFQ.Triple triple = getViewProperty().asTriple(subject, object, vars); assertEquals(subject, triple.S); assertEquals(uri, ((URINode)triple.P).spelling()); assertEquals(object, triple.O); }
@Test public void viewProperty_toString_ReturnsUri() { String result = getViewProperty().toString(); assertEquals(uri, result); }
@Test public void viewProperty_asProperty_ReturnsProperty() { Property prop = getViewProperty().asProperty(); assertEquals(uri, prop.getURI()); }