VirtualMetadataPopulator { public boolean isUseForPlaceTrueForRelationshipType(RelationshipType relationshipType, boolean isLeft) { HashMap<String, VirtualMetadataConfiguration> hashMaps; if (isLeft) { hashMaps = this.getMap().get(relationshipType.getLeftwardType()); } else { hashMaps = this.getMap().get(relationshipType.getRightwardType()); } if (hashMaps != null) { for (Map.Entry<String, VirtualMetadataConfiguration> entry : hashMaps.entrySet()) { VirtualMetadataConfiguration virtualBean = entry.getValue(); boolean useForPlace = virtualBean.getUseForPlace(); if (useForPlace) { return true; } } } return false; }  void setMap(Map<String, HashMap<String, VirtualMetadataConfiguration>> map); Map<String, HashMap<String, VirtualMetadataConfiguration>> getMap(); boolean isUseForPlaceTrueForRelationshipType(RelationshipType relationshipType, boolean isLeft);  }
@Test public void testIsUseForPlaceTrueForRelationshipType() { RelationshipType relationshipType = mock(RelationshipType.class); Map<String, HashMap<String, VirtualMetadataConfiguration>> map = new HashMap<>(); HashMap<String, VirtualMetadataConfiguration> mapExt = new HashMap<>(); VirtualMetadataConfiguration virtualMetadataConfiguration = mock(VirtualMetadataConfiguration.class); mapExt.put("hashKey", virtualMetadataConfiguration); map.put("LeftwardType", mapExt); map.put("NotRightwardType", mapExt); virtualMetadataPopulator.setMap(map); when(virtualMetadataConfiguration.getUseForPlace()).thenReturn(true); when(relationshipType.getLeftwardType()).thenReturn("LeftwardType"); when(relationshipType.getRightwardType()).thenReturn("RightwardType"); assertEquals("TestGetFields 0", false, virtualMetadataPopulator.isUseForPlaceTrueForRelationshipType(relationshipType, false)); assertEquals("TestGetFields 1", true, virtualMetadataPopulator.isUseForPlaceTrueForRelationshipType(relationshipType, true)); }