package edu.grinnell.callaway;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class ParseExceptionsTest
{

  JSONParser parser = new JSONParser();

  @Rule
  public ExpectedException thrown = ExpectedException.none();

  @Test
  public void parserTest()
    throws Exception
  {
    thrown.expect(Exception.class);
    thrown.expectMessage("\nJSON ERROR: no json values found in input");
    parser.parseFromSource("");
  }
  
  @Test
  public void numberTest2()
    throws Exception
  {
    thrown.expect(Exception.class);
    thrown.expectMessage("\nJSON NUMBER ERROR(L1:C0): invalid number 15-\n15-\n^");
    parser.parseFromSource("15-");
  }


  @Test
  public void runNumberTest3()
    throws Exception
  {
    thrown.expect(Exception.class);
    thrown.expectMessage("\nJSON NUMBER ERROR(L1:C0): invalid number 13+\n13+\n^");
    parser.parseFromSource("13+");
  }
}

@@ -288,18 +288,20 @@
 oid 
-parser
+noJason
 Test
+1
 ()%0A 
@@ -473,44 +473,932 @@
   %7D%0A
+%0A
   
-%0A  @Test%0A  public void numberTest2
+@Test%0A  public void noJasonTest2()%0A    throws Exception%0A  %7B%0A    thrown.expect(Exception.class);%0A    thrown.expectMessage(%22%5CnJSON ERROR: no json values found in input%22);%0A    parser.parseFromSource(%22 %5Ct %5Cn %5Cr %5Cb %5Cf %22);%0A  %7D%0A%0A  @Test%0A  public void invalidCharTest1()%0A    throws Exception%0A  %7B%0A    thrown.expect(Exception.class);%0A    thrown.expectMessage(%22%5CnJSON ERROR(L1:C0): Invalid input character a%5Cna%5Cn%5E%22);%0A    parser.parseFromSource(%22a%22);%0A  %7D%0A%0A  @Test%0A  public void invalidCharTest2()%0A    throws Exception%0A  %7B%0A    thrown.expect(Exception.class);%0A    thrown.expectMessage(%22%5CnJSON ERROR(L1:C0): Invalid input character @%5Cn@%5Cn%5E%22);%0A    parser.parseFromSource(%22@%22);%0A  %7D%0A%0A  @Test%0A  public void invalidCharTest3()%0A    throws Exception%0A  %7B%0A    thrown.expect(Exception.class);%0A    thrown.expectMessage(%22%5CnJSON ERROR(L1:C0): Invalid input character %7D%5Cn%7D%5Cn%5E%22);%0A    parser.parseFromSource(%22%7D%22);%0A  %7D%0A%0A  @Test%0A  public void numberTest1
 ()%0A 
@@ -1581,17 +1581,16 @@
 );%0A  %7D%0A%0A
-%0A
   @Test%0A
@@ -1607,12 +1607,9 @@
 oid 
-runN
+n
 umbe
@@ -1609,25 +1609,25 @@
 d numberTest
-3
+2
 ()%0A    throw
@@ -1800,11 +1800,984 @@
 +%22);%0A  %7D
+%0A%0A  @Test%0A  public void booleanTrueTest()%0A    throws Exception%0A  %7B%0A    thrown.expect(Exception.class);%0A    thrown.expectMessage(%22%5CnJSON BOOLEAN ERROR(L1:C4): expected input %5C%22true%5C%22%5Cntruqqqqqq%5Cn    %5E%22);%0A    parser.parseFromSource(%22truqqqqqq%22);%0A  %7D%0A%0A  @Test%0A  public void booleanFalseTest()%0A    throws Exception%0A  %7B%0A    thrown.expect(Exception.class);%0A    thrown.expectMessage(%22%5CnJSON BOOLEAN ERROR(L1:C3): expected input %5C%22false%5C%22%5Cnfake%5Cn   %5E%22);%0A    parser.parseFromSource(%22fake%22);%0A  %7D%0A%0A  @Test%0A  public void nullTest()%0A    throws Exception%0A  %7B%0A    thrown.expect(Exception.class);%0A    thrown.expectMessage(%22%5CnJSON NULL ERROR(L1:C3): expected input %5C%22null%5C%22%5Cnnunya%5Cn   %5E%22);%0A    parser.parseFromSource(%22nunya%22);%0A  %7D%0A  %0A  @Test%0A  public void stringTest1()%0A    throws Exception%0A  %7B%0A    thrown.expect(Exception.class);%0A    thrown.expectMessage(%22%5CnJSON STRING ERROR(L1:C8): no closing %5C%22 before end of input%5Cn%5C%22string%5C%5C%5Cn        %5E%22);%0A    parser.parseFromSource(%22%5C%22string%5C%5C%22);%0A  %7D
 %0A%7D%0A

add tests for true, false, null, and string