@Test
public void buildEntity() {

  EdmEntityType entityType = mock(EdmEntityType.class);
  when(entityType.getFullQualifiedName()).thenReturn(new FullQualifiedName("namespace", "entityType"));
  ContextURL contextURL = ContextURL.with().serviceRoot(serviceRoot)
      .type(entityType)
      .build();
  assertEquals(serviceRoot + "$metadata#namespace.entityType",
      ContextURLBuilder.create(contextURL).toASCIIString());
  contextURL = ContextURL.with().serviceRoot(serviceRoot)
      .type(entityType)
      .asCollection()
      .build();
  assertEquals(serviceRoot + "$metadata#Collection(namespace.entityType)",
      ContextURLBuilder.create(contextURL).toASCIIString());
}