@Test
public void testTestAgentLaunchParameter() throws Exception {

  AgentLaunchParameter alp = new AgentLaunchParameter("");
  Assert.assertEquals("", alp.getNextLaunchParameter("abc"));
  Assert.assertEquals("", alp.getNextLaunchParameter("HBASE_MASTER"));
  alp = new AgentLaunchParameter("a:1:2:3|b:5:6:NONE");
  Assert.assertEquals("1", alp.getNextLaunchParameter("a"));
  Assert.assertEquals("2", alp.getNextLaunchParameter("a"));
  Assert.assertEquals("3", alp.getNextLaunchParameter("a"));
  Assert.assertEquals("3", alp.getNextLaunchParameter("a"));
  Assert.assertEquals("5", alp.getNextLaunchParameter("b"));
  Assert.assertEquals("6", alp.getNextLaunchParameter("b"));
  Assert.assertEquals("", alp.getNextLaunchParameter("b"));
  Assert.assertEquals("", alp.getNextLaunchParameter("b"));
  Assert.assertEquals("", alp.getNextLaunchParameter("c"));
  alp = new AgentLaunchParameter("|a:1:3|b::5:NONE:");
  Assert.assertEquals("1", alp.getNextLaunchParameter("a"));
  Assert.assertEquals("3", alp.getNextLaunchParameter("a"));
  Assert.assertEquals("3", alp.getNextLaunchParameter("a"));
  Assert.assertEquals("", alp.getNextLaunchParameter("b"));
  Assert.assertEquals("5", alp.getNextLaunchParameter("b"));
  Assert.assertEquals("", alp.getNextLaunchParameter("b"));
  Assert.assertEquals("", alp.getNextLaunchParameter("b"));
  alp = new AgentLaunchParameter("|:");
  Assert.assertEquals("", alp.getNextLaunchParameter("b"));
  Assert.assertEquals("", alp.getNextLaunchParameter("a"));
  alp = new AgentLaunchParameter("HBASE_MASTER:a,b:DO_NOT_REGISTER:");
  Assert.assertEquals("a,b", alp.getNextLaunchParameter("HBASE_MASTER"));
  Assert.assertEquals("DO_NOT_REGISTER", alp.getNextLaunchParameter("HBASE_MASTER"));
  Assert.assertEquals("DO_NOT_REGISTER", alp.getNextLaunchParameter("HBASE_MASTER"));
  alp = new AgentLaunchParameter("HBASE_MASTER:a,b:DO_NOT_REGISTER::c:::");
  Assert.assertEquals("a,b", alp.getNextLaunchParameter("HBASE_MASTER"));
  Assert.assertEquals("DO_NOT_REGISTER", alp.getNextLaunchParameter("HBASE_MASTER"));
  Assert.assertEquals("", alp.getNextLaunchParameter("HBASE_MASTER"));
  Assert.assertEquals("c", alp.getNextLaunchParameter("HBASE_MASTER"));
  Assert.assertEquals("c", alp.getNextLaunchParameter("HBASE_MASTER"));
}