@Test
public void testInvalidTerms() {        

    try {
        new ExtendedParser("))()()").readTerm();
        fail("Expected invalid term error");
    } catch (ParserException e) {
        // Expected
    }
    
    try {
        new ExtendedParser("(())").readTerm();
        fail("Expected invalid term error");
    } catch (ParserException e) {
        // Expected
    }
    
    try {
        new ExtendedParser("((a))").readTerm();
        fail("Expected invalid term error");
    } catch (ParserException e) {
        // Expected
    }
    
    try {
        new ExtendedParser("-*").readTerm();
        fail("Expected invalid term error");
    } catch (ParserException e) {
        // Expected
    }
    
    try {
        new ExtendedParser("-").readTerm();
        fail("Expected invalid term error");
    } catch (ParserException e) {
        // Expected
    }
    
    try {
        new ExtendedParser("*").readTerm();
        fail("Expected invalid term error");
    } catch (ParserException e) {
        // Expected
    }
}