### Question:
Datacenter { List<DataNode> getDataNodes() { return dataNodes; } Datacenter(HardwareLayout hardwareLayout, JSONObject jsonObject, ClusterMapConfig clusterMapConfig); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void validation() throws JSONException { JSONObject jsonObject; ClusterMapConfig clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); try { jsonObject = TestUtils.getJsonDatacenter("XYZ1", (byte) 1, getDataNodes()); new Datacenter(null, jsonObject, clusterMapConfig); fail("Should have failed validation."); } catch (IllegalStateException e) { } jsonObject = TestUtils.getJsonDatacenter("", (byte) 1, getDataNodes()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDatacenter("XYZ1", (byte) 1, getDataNodesPartiallyRackAware()); failValidation(jsonObject, clusterMapConfig); }