package pingis.utils;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Created by dwarfcrank on 7/21/17.
 */
public class JavaSyntaxCheckerTest {
    @Test
    public void testValidClassDeclaration() {
        final String code = "public class TestClass { }";

        String[] errors = JavaSyntaxChecker.parseCode(code);
        assertNull(errors);
    }

    @Test
    public void testInvalidClassDeclaration() {
        final String code = "public class Broken {";
        final String[] expected = new String[] {
                "(line 1,col 21) Parse error. Found <EOF>, expected one of  \";\" \"<\" \"@\" \"abstract\" "
                        + "\"boolean\" \"byte\" \"char\" \"class\" \"default\" \"double\" \"enum\" \"exports\" "
                        + "\"final\" \"float\" \"int\" \"interface\" \"long\" \"module\" \"native\" \"open\" "
                        + "\"opens\" \"private\" \"protected\" \"provides\" \"public\" \"requires\" \"short\" "
                        + "\"static\" \"strictfp\" \"synchronized\" \"to\" \"transient\" \"transitive\" \"uses\" "
                        + "\"void\" \"volatile\" \"with\" \"{\" \"}\" <IDENTIFIER>"
        };

        String[] errors = JavaSyntaxChecker.parseCode(code);

        assertArrayEquals(expected, errors);
    }
}

@@ -540,20 +540,16 @@
         
-    
 %22(line 1
@@ -649,28 +649,24 @@
             
-    
 + %22%5C%22boolean
@@ -738,28 +738,24 @@
 exports%5C%22 %22%0A
-    
             
@@ -865,28 +865,24 @@
             
-    
 + %22%5C%22opens%5C%22
@@ -953,28 +953,24 @@
 %5C%22short%5C%22 %22%0A
-    
             
@@ -1064,28 +1064,24 @@
  %5C%22uses%5C%22 %22%0A
-    
             

Fix checkstyle complaints.