@Test
  public void testValidateClusterName() throws Exception {
    AmbariManagementControllerImpl.validateClusterName("clustername");
    AmbariManagementControllerImpl.validateClusterName("CLUSTERNAME");
    AmbariManagementControllerImpl.validateClusterName("clustername123");
    AmbariManagementControllerImpl.validateClusterName("cluster-name");
    AmbariManagementControllerImpl.validateClusterName("cluster_name");
    try {
      AmbariManagementControllerImpl.validateClusterName(null);
      Assert.fail("IllegalArgumentException not thrown");
    } catch (IllegalArgumentException e) {
      // This is expected
    }
    try {
      AmbariManagementControllerImpl.validateClusterName("clusternameclusternameclusternameclusternameclusternameclusternameclusternameclusternameclusternameclustername");
      Assert.fail("IllegalArgumentException not thrown");
    } catch (IllegalArgumentException e) {
      // This is expected
    }
    try {
      AmbariManagementControllerImpl.validateClusterName("clustername@#$%");
      Assert.fail("IllegalArgumentException not thrown");
    } catch (IllegalArgumentException e) {
      // This is expected
    }
    try {
      AmbariManagementControllerImpl.validateClusterName("");
      Assert.fail("IllegalArgumentException not thrown");
    } catch (IllegalArgumentException e) {
      // This is expected
    }
  }
Ensure that validateClusterName(String clusterName) work as expected.
Character Requirements
<p>
A through Z
a through z
0 through 9
_ (underscore)
- (dash)
Length Requirements
<p>
Minimum: 1 character
Maximum: 100 characters
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java