### Question:
GraphQueryImpl implements Queries.GraphQuery, Queries.GraphTraversal { @Override public Queries.GraphTraversal selectAdjacentEntitiesVia( Relationship.Name name) { Preconditions.argumentNotNull(name, "name::"+Relationship.Name.class.getName()); pipeline.add(new SelectEntities(name, null)); return this; } GraphQueryImpl(GraphVisitor repository); @Override Queries.GraphTraversal selectAdjacentEntitiesVia(
			Relationship.Name name); @Override Queries.GraphTraversal selectAdjacentEntitiesVia(
			Relationship.Name name, Direction direction); @Override Queries.GraphTraversal selectAdjacentRelationships(
			Relationship.Name name); @Override Queries.GraphTraversal selectAdjacentRelationships(
			Relationship.Name name, Direction direction); @Override Queries.GraphTraversal where(Predicate predicate); @Override Queries.GraphTraversal fromRootEntity(ID id); @Override Projection select();  }### Answer:
@Test public void testSelectAdjacentEntitiesWithNullName() { GraphVisitor repository = new MockGraphVisitor(); GraphQueryImpl graphQueryImpl = new GraphQueryImpl(repository); try { graphQueryImpl.selectAdjacentEntitiesVia(null); Assert.fail("Should have thrown an exception for null name"); } catch (Exception e) { AssertJUnit.assertTrue(e instanceof IllegalArgumentException); AssertJUnit.assertEquals(e.getMessage(), "Parameter \"name::com.intuit.ugc.api.Relationship$Name\" cannot be null"); } }
@Test public void testSelectAdjacentEntitiesWithNullRelationshipNameAndValidDirection() { GraphVisitor repository = new MockGraphVisitor(); GraphQueryImpl graphQueryImpl = new GraphQueryImpl(repository); Direction direction = Direction.IN_OUT; try { graphQueryImpl.selectAdjacentEntitiesVia(null, direction); Assert.fail("Should have thrown an exception for null name"); } catch (Exception e) { AssertJUnit.assertTrue(e instanceof IllegalArgumentException); AssertJUnit.assertEquals(e.getMessage(), "Parameter \"name::com.intuit.ugc.api.Relationship$Name\" cannot be null"); } }
@Test public void testSelectAdjacentEntitiesWithRelationshipNameButNullDirection() { GraphVisitor repository = new MockGraphVisitor(); GraphQueryImpl graphQueryImpl = new GraphQueryImpl(repository); try { graphQueryImpl.selectAdjacentEntitiesVia(TartanImplTestConstants.ATTR_DUMMY_RELATIONSHIP_NAME, null); Assert.fail("Should have thrown an exception for null direction"); } catch (Exception e) { AssertJUnit.assertTrue(e instanceof IllegalArgumentException); AssertJUnit.assertEquals(e.getMessage(), "Parameter \"direction::com.intuit.ugc.api.Queries$GraphTraversal$Direction\" cannot be null"); } }
@Test public void testSelectAdjacentEntitiesWithValidRelationshipNameAndDirection() { GraphVisitor repository = new MockGraphVisitor(); GraphQueryImpl graphQueryImpl = new GraphQueryImpl(repository); Direction direction = Direction.IN_OUT; GraphTraversal adjacentEntitiesTraversal = graphQueryImpl .selectAdjacentEntitiesVia(TartanImplTestConstants.ATTR_DUMMY_RELATIONSHIP_NAME, direction); AssertJUnit.assertNotNull(adjacentEntitiesTraversal); }