### Question:
Generator extends AbstractMojo { protected void validateDbName() throws MojoExecutionException { if (dbName == null || dbName.trim().length() == 0 || !dbName.matches(DBNAME_PATTERN)) { throw new MojoExecutionException("EasyDao engine configuration exception: wrong dbName. Required field, max. 16 characters, regExp: " + DBNAME_PATTERN); } else { if (dbName.length() > 16) { dbName = dbName.substring(0, 15); } } }  void execute();  }### Answer:
@Test public void testValidateDbName_GOOD1() throws Exception { System.out.println("testValidateDbName_GOOD1"); Generator instance = new Generator(); instance.dbName = "callisto"; instance.validateDbName(); }
@Test public void testValidateDbName_GOOD2() throws Exception { System.out.println("testValidateDbName_GOOD2"); Generator instance = new Generator(); instance.dbName = "callisto1111"; instance.validateDbName(); }
@Test(expected = MojoExecutionException.class) public void testValidateDbName_WRONG1() throws Exception { System.out.println("testValidateDbName_WRONG1"); Generator instance = new Generator(); instance.dbName = "CALLISTO"; instance.validateDbName(); }
@Test(expected = MojoExecutionException.class) public void testValidateDbName_WRONG2() throws Exception { System.out.println("testValidateDbName_WRONG2"); Generator instance = new Generator(); instance.dbName = "111callisto"; instance.validateDbName(); }
@Test(expected = MojoExecutionException.class) public void testValidateDbName_WRONG3() throws Exception { System.out.println("testValidateDbName_WRONG3"); Generator instance = new Generator(); instance.dbName = "cal-listo"; instance.validateDbName(); }
@Test(expected = MojoExecutionException.class) public void testValidateDbName_WRONG4() throws Exception { System.out.println("testValidateDbName_WRONG4"); Generator instance = new Generator(); instance.dbName = "cal listo"; instance.validateDbName(); }
@Test(expected = MojoExecutionException.class) public void testValidateDbName_WRONG5() throws Exception { System.out.println("testValidateDbName_WRONG5"); Generator instance = new Generator(); instance.dbName = " "; instance.validateDbName(); }
@Test(expected = MojoExecutionException.class) public void testValidateDbName_NULL() throws Exception { System.out.println("testValidateDbName_NULL"); Generator instance = new Generator(); instance.dbName = null; instance.validateDbName(); }