### Question:
PartitionLayout { @Override public String toString() { try { return toJSONObject().toString(2); } catch (JSONException e) { logger.error("JSONException caught in toString: ", e.getCause()); } return null; } PartitionLayout(HardwareLayout hardwareLayout, JSONObject jsonObject, ClusterMapConfig clusterMapConfig);  PartitionLayout(HardwareLayout hardwareLayout, ClusterMapConfig clusterMapConfig); HardwareLayout getHardwareLayout(); String getClusterName(); long getVersion(); long getPartitionCount(); long getPartitionInStateCount(PartitionState partitionState); List<PartitionId> getPartitions(String partitionClass); List<PartitionId> getWritablePartitions(String partitionClass); PartitionId getRandomWritablePartition(String partitionClass, List<PartitionId> toExclude); long getAllocatedRawCapacityInBytes(); long getAllocatedUsableCapacityInBytes(); Partition addNewPartition(List<Disk> disks, long replicaCapacityInBytes, String partitionClass); void addNewReplicas(Partition partition, List<Disk> disks); Partition getPartition(InputStream stream); JSONObject toJSONObject(); List<String> getAllPartitionNames(); @Override String toString(); @Override boolean equals(Object o);  }### Answer:
@Test public void validation() throws JSONException { TestHardwareLayout testHardwareLayout = new TestHardwareLayout("Alpha"); try { TestPartitionLayout tpl = new TestPartitionLayoutWithDuplicatePartitions(testHardwareLayout); fail("Should have failed validation:" + tpl.getPartitionLayout().toString()); } catch (IllegalStateException e) { } try { TestPartitionLayout tpl = new TestPartitionLayoutWithDuplicateReplicas(testHardwareLayout); fail("Should have failed validation:" + tpl.getPartitionLayout().toString()); } catch (IllegalStateException e) { } }