Program: 25043
Project: 25043
Buggy source:
@Test public void testParse(){
  final String WRONG_FULL_SYNTAX="String_Node_Str";
  final String WRONG_PARAM_SYNTAX="String_Node_Str";
  try {
    FunctionDef.parse(null);
    fail("String_Node_Str");
  }
 catch (  Exception ex) {
    assertTrue(ex instanceof NullPointerException);
    assertEquals("String_Node_Str",ex.getMessage());
  }
  try {
    FunctionDef.parse("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  Exception ex) {
    assertTrue(ex instanceof ParseException);
    assertEquals(WRONG_FULL_SYNTAX,ex.getMessage());
  }
  try {
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
  }
 catch (  Exception ex) {
    ex.printStackTrace(System.err);
    fail("String_Node_Str");
  }
  try {
    for (    DBDatatype t : DBDatatype.values()) {
switch (t) {
case CHAR:
case VARCHAR:
case BINARY:
case VARBINARY:
        assertEquals("String_Node_Str" + t.toString() + "String_Node_Str",FunctionDef.parse("String_Node_Str" + t.toString() + "String_Node_Str").toString());
      break;
default :
    assertEquals("String_Node_Str" + t.toString(),FunctionDef.parse("String_Node_Str" + t.toString() + "String_Node_Str").toString());
}
}
}
 catch (Exception ex) {
ex.printStackTrace(System.err);
fail("String_Node_Str");
}
try {
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
}
 catch (Exception ex) {
ex.printStackTrace(System.err);
fail("String_Node_Str");
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_FULL_SYNTAX,ex.getMessage());
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_FULL_SYNTAX,ex.getMessage());
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_FULL_SYNTAX,ex.getMessage());
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_FULL_SYNTAX,ex.getMessage());
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals("String_Node_Str",ex.getMessage());
}
try {
FunctionDef fct=FunctionDef.parse("String_Node_Str");
assertTrue(fct.isUnknown);
assertTrue(fct.isString);
assertTrue(fct.isNumeric);
assertTrue(fct.isGeometry);
assertEquals("String_Node_Str",fct.returnType.type.toString());
}
 catch (Exception ex) {
ex.printStackTrace(System.err);
fail("String_Node_Str");
}
try {
FunctionDef fct=FunctionDef.parse("String_Node_Str");
assertTrue(fct.isUnknown);
assertTrue(fct.isString);
assertTrue(fct.isNumeric);
assertTrue(fct.isGeometry);
assertEquals("String_Node_Str",fct.returnType.type.toString());
}
 catch (Exception ex) {
ex.printStackTrace(System.err);
fail("String_Node_Str");
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_FULL_SYNTAX,ex.getMessage());
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_PARAM_SYNTAX,ex.getMessage());
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_PARAM_SYNTAX,ex.getMessage());
}
try {
FunctionDef fct=FunctionDef.parse("String_Node_Str");
assertTrue(fct.getParam(0).type.isUnknown());
assertTrue(fct.getParam(0).type.isString());
assertTrue(fct.getParam(0).type.isNumeric());
assertTrue(fct.getParam(0).type.isGeometry());
assertEquals("String_Node_Str",fct.getParam(0).type.toString());
}
 catch (Exception ex) {
ex.printStackTrace(System.err);
fail("String_Node_Str");
}
try {
FunctionDef fct=FunctionDef.parse("String_Node_Str");
assertTrue(fct.getParam(0).type.isUnknown());
assertTrue(fct.getParam(0).type.isString());
assertTrue(fct.getParam(0).type.isNumeric());
assertTrue(fct.getParam(0).type.isGeometry());
assertEquals("String_Node_Str",fct.getParam(0).type.toString());
}
 catch (Exception ex) {
ex.printStackTrace(System.err);
fail("String_Node_Str");
}
}

Fixed version (ground truth):
@Test public void testParse(){
  final String WRONG_FULL_SYNTAX="String_Node_Str";
  final String WRONG_PARAM_SYNTAX="String_Node_Str";
  try {
    FunctionDef.parse(null);
    fail("String_Node_Str");
  }
 catch (  Exception ex) {
    assertTrue(ex instanceof NullPointerException);
    assertEquals("String_Node_Str",ex.getMessage());
  }
  try {
    FunctionDef.parse("String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  Exception ex) {
    assertTrue(ex instanceof ParseException);
    assertEquals(WRONG_FULL_SYNTAX,ex.getMessage());
  }
  try {
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
    assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
  }
 catch (  Exception ex) {
    ex.printStackTrace(System.err);
    fail("String_Node_Str");
  }
  try {
    for (    DBDatatype t : DBDatatype.values()) {
switch (t) {
case CHAR:
case VARCHAR:
case BINARY:
case VARBINARY:
        assertEquals("String_Node_Str" + t.toString() + "String_Node_Str",FunctionDef.parse("String_Node_Str" + t.toString() + "String_Node_Str").toString());
      break;
default :
    assertEquals("String_Node_Str" + t.toString(),FunctionDef.parse("String_Node_Str" + t.toString() + "String_Node_Str").toString());
}
}
}
 catch (Exception ex) {
ex.printStackTrace(System.err);
fail("String_Node_Str");
}
try {
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
assertEquals("String_Node_Str",FunctionDef.parse("String_Node_Str").toString());
}
 catch (Exception ex) {
ex.printStackTrace(System.err);
fail("String_Node_Str");
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_FULL_SYNTAX,ex.getMessage());
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_FULL_SYNTAX,ex.getMessage());
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_FULL_SYNTAX,ex.getMessage());
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_FULL_SYNTAX,ex.getMessage());
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals("String_Node_Str",ex.getMessage());
}
try {
FunctionDef fct=FunctionDef.parse("String_Node_Str");
assertTrue(fct.isUnknown);
assertFalse(fct.isString);
assertFalse(fct.isNumeric);
assertFalse(fct.isGeometry);
assertEquals("String_Node_Str",fct.returnType.type.toString());
}
 catch (Exception ex) {
ex.printStackTrace(System.err);
fail("String_Node_Str");
}
try {
FunctionDef fct=FunctionDef.parse("String_Node_Str");
assertTrue(fct.isUnknown);
assertFalse(fct.isString);
assertFalse(fct.isNumeric);
assertFalse(fct.isGeometry);
assertEquals("String_Node_Str",fct.returnType.type.toString());
}
 catch (Exception ex) {
ex.printStackTrace(System.err);
fail("String_Node_Str");
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_FULL_SYNTAX,ex.getMessage());
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_PARAM_SYNTAX,ex.getMessage());
}
try {
FunctionDef.parse("String_Node_Str");
fail("String_Node_Str");
}
 catch (Exception ex) {
assertTrue(ex instanceof ParseException);
assertEquals(WRONG_PARAM_SYNTAX,ex.getMessage());
}
try {
FunctionDef fct=FunctionDef.parse("String_Node_Str");
assertTrue(fct.getParam(0).type.isUnknown());
assertFalse(fct.getParam(0).type.isString());
assertFalse(fct.getParam(0).type.isNumeric());
assertFalse(fct.getParam(0).type.isGeometry());
assertEquals("String_Node_Str",fct.getParam(0).type.toString());
}
 catch (Exception ex) {
ex.printStackTrace(System.err);
fail("String_Node_Str");
}
try {
FunctionDef fct=FunctionDef.parse("String_Node_Str");
assertTrue(fct.getParam(0).type.isUnknown());
assertFalse(fct.getParam(0).type.isString());
assertFalse(fct.getParam(0).type.isNumeric());
assertFalse(fct.getParam(0).type.isGeometry());
assertEquals("String_Node_Str",fct.getParam(0).type.toString());
}
 catch (Exception ex) {
ex.printStackTrace(System.err);
fail("String_Node_Str");
}
}