### Question:
DataCenterSpec extends AbstractDataCenter<ClusterSpec, NodeSpec> { public NodeSpec.Builder addNode() { return new NodeSpec.Builder(this, nodeCounter.getAndIncrement(), UUID.randomUUID()); } DataCenterSpec();  DataCenterSpec(
      String name,
      Long id,
      String cassandraVersion,
      String dseVersion,
      Map<String, Object> peerInfo,
      ClusterSpec parent); NodeSpec.Builder addNode();  }### Answer:
@Test public void testAddNodeShouldAssignId() { DataCenterSpec dc = new DataCenterSpec(); for (int i = 0; i < 5; i++) { NodeSpec node = dc.addNode().build(); assertThat(node.getId()).isEqualTo((long) i); assertThat(node.getDataCenter()).isEqualTo(dc); assertThat(node.getParent()).isEqualTo(Optional.of(dc)); assertThat(dc.getNodes()).contains(node); } assertThat(dc.getNodes()).hasSize(5); }
@Test public void testLookupNode() { DataCenterSpec dc = new DataCenterSpec(); dc.addNode().build(); dc.addNode().build(); dc.addNode().build(); assertThat(dc.node(0).getId()).isEqualTo(0); assertThat(dc.node(1).getId()).isEqualTo(1); assertThat(dc.node(2).getId()).isEqualTo(2); assertThat(dc.node(3)).isNull(); }
@Test public void testCopy() { ClusterSpec cluster = ClusterSpec.builder().build(); DataCenterSpec dc = cluster .addDataCenter() .withName("dc2") .withCassandraVersion("1.2.19") .withDSEVersion("5.1.0") .withPeerInfo("hello", "world") .build(); dc.addNode().build(); dc.addNode().build(); DataCenterSpec dc2 = cluster.addDataCenter().copy(dc).build(); assertThat(dc2.getId()).isEqualTo(dc.getId()); assertThat(dc2.getName()).isEqualTo(dc.getName()); assertThat(dc2.getCassandraVersion()).isEqualTo(dc.getCassandraVersion()); assertThat(dc2.getPeerInfo()).isEqualTo(dc.getPeerInfo()); assertThat(dc2.getNodes()).isEmpty(); }