  @Test
  public void testBuilder() {

    // empty builder should fail
    try {
      MetadataEntity.builder().build();
      Assert.fail();
    } catch (IllegalArgumentException e) {
      // expected
    }
    // test that builder builds metadata entity correctly
    MetadataEntity metadataEntity = MetadataEntity.builder().append(MetadataEntity.NAMESPACE, "ns")
      .appendAsType(MetadataEntity.DATASET, "myDataset").build();
    assertEquals(metadataEntity.getKeys(), MetadataEntity.NAMESPACE, MetadataEntity.DATASET);
    assertEquals(metadataEntity.getValues(), "ns", "myDataset");
  }