### Question:
MetaverseNode implements IMetaverseNode { @Override public String getLogicalId() { if ( logicalIdGenerator == null ) { return getStringID(); } else if ( logicalId == null || isDirty() ) { logicalId = logicalIdGenerator.generateId( this ); } return logicalId == null ? getStringID() : logicalId; } @SuppressWarnings( "unused" ) private  MetaverseNode();  MetaverseNode( Vertex v ); @Override String getName(); @Override String getStringID(); @Override String getType(); @Override void setName( String name ); @Override void setType( String type ); @Override Set<String> getPropertyKeys(); @Override Map<String, Object> getProperties(); @Override void setProperties( Map<String, Object> properties ); @Override void removeProperties( Set<String> keys ); @Override void clearProperties(); @Override boolean containsKey( String key ); @Override Object getProperty( String key ); @Override void setProperty( String key, Object value ); @Override Object removeProperty( String key ); Edge addEdge( String arg0, Vertex arg1 ); Iterable<Edge> getEdges( Direction arg0, String... arg1 ); Object getId(); Iterable<Vertex> getVertices( Direction arg0, String... arg1 ); VertexQuery query(); void remove(); @Override String getLogicalId(); @Override void setLogicalIdGenerator( ILogicalIdGenerator idGenerator ); @Override boolean isDirty(); @Override void setDirty( boolean dirty );  }### Answer:
@Test public void testGetLogicalId() throws Exception { MetaverseNode node = new MetaverseNode( v ); when( v.getProperty( "name" ) ).thenReturn( "testName" ); when( v.getProperty( "zzz" ) ).thenReturn( "last" ); when( v.getProperty( "type" ) ).thenReturn( "testType" ); MetaverseNode spyNode = spy( node ); when( spyNode.getPropertyKeys() ).thenReturn( new HashSet<String>() {{ add( "name" ); add( "type" ); add( "zzz" ); }} ); assertEquals( "{\"name\":\"testName\",\"namespace\":\"\",\"type\":\"testType\"}", spyNode.getLogicalId() ); ILogicalIdGenerator idGenerator = new MetaverseLogicalIdGenerator( "type", "zzz", "name" ); spyNode.setLogicalIdGenerator( idGenerator ); assertNotNull( spyNode.logicalIdGenerator ); assertEquals( "{\"name\":\"testName\",\"type\":\"testType\",\"zzz\":\"last\"}", spyNode.getLogicalId() ); }