BigtableConfig implements Serializable { void populateDisplayData(DisplayData.Builder builder) { builder .addIfNotNull( DisplayData.item("projectId", getProjectId()).withLabel("Bigtable Project Id")) .addIfNotNull( DisplayData.item("instanceId", getInstanceId()).withLabel("Bigtable Instance Id")) .addIfNotNull(DisplayData.item("tableId", getTableId()).withLabel("Bigtable Table Id")) .add(DisplayData.item("withValidation", getValidate()).withLabel("Check is table exists")); if (getBigtableOptions() != null) { builder.add( DisplayData.item("bigtableOptions", getBigtableOptions().toString()) .withLabel("Bigtable Options")); } }  @Override String toString();  }
@Test public void testPopulateDisplayData() { DisplayData displayData = DisplayData.from( config.withProjectId(PROJECT_ID).withInstanceId(INSTANCE_ID).withTableId(TABLE_ID) ::populateDisplayData); assertThat( displayData, hasDisplayItem( allOf( hasKey("projectId"), hasLabel("Bigtable Project Id"), hasValue(PROJECT_ID.get())))); assertThat( displayData, hasDisplayItem( allOf( hasKey("instanceId"), hasLabel("Bigtable Instance Id"), hasValue(INSTANCE_ID.get())))); assertThat( displayData, hasDisplayItem( allOf(hasKey("tableId"), hasLabel("Bigtable Table Id"), hasValue(TABLE_ID.get())))); }