View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.lang.plsql;
5   
6   import org.junit.Test;
7   
8   
9   public class PLSQLParserTest extends AbstractPLSQLParserTst {
10  
11  	@Test
12  	public void testExceptions() {
13  		parsePLSQL(
14  			"CREATE OR REPLACE PROCEDURE bar IS BEGIN"
15  		  + "    doSomething;"
16  		  + "    EXCEPTION"
17  		  + "    WHEN FooException THEN"
18  		  + "        doSomethingElse;"
19  		  + "    WHEN OTHERS THEN"
20  		  + "        doSomethingElse;"
21  		  + "END;");
22  	}
23  
24      /**
25       * See https://sourceforge.net/p/pmd/bugs/1167/
26       */
27      @Test
28      public void testBOM() {
29          parsePLSQL("\ufeff" +
30              "CREATE OR REPLACE PROCEDURE bar IS BEGIN"
31            + "    doSomething;"
32            + "    EXCEPTION"
33            + "    WHEN FooException THEN"
34            + "        doSomethingElse;"
35            + "    WHEN OTHERS THEN"
36            + "        doSomethingElse;"
37            + "END;");
38      }
39  }