package edu.jhu.thrax.util.io;

import org.testng.annotations.Test;
import org.testng.Assert;
import edu.jhu.thrax.util.exceptions.*;

public class InputUtilitiesTest
{
    @Test
    public void parseYield_EmptyString_ReturnsZeroLengthArray() throws MalformedParseException
    {
        Assert.assertEquals(InputUtilities.parseYield("").length, 0);
    }

    @Test
    public void parseYield_Whitespace_ReturnsZeroLengthArray() throws MalformedParseException
    {
        Assert.assertEquals(InputUtilities.parseYield("        ").length, 0);
    }
    @Test
    public void parseYield_EmptyParse_ReturnsZeroLengthArray() throws MalformedParseException
    {
        Assert.assertEquals(InputUtilities.parseYield("()").length, 0);
    }

    @Test(expectedExceptions = { MalformedParseException.class })
    public void parseYield_UnbalancedLeft_ThrowsException() throws MalformedParseException
    {
        InputUtilities.parseYield("(S (DT the) (NP dog)");
    }

    @Test(expectedExceptions = { MalformedParseException.class })
    public void parseYield_UnbalancedRight_ThrowsException() throws MalformedParseException
    {
        InputUtilities.parseYield("(S (DT the) (NP dog)))");
    }

    @Test
    public void getWords_EmptyString_ReturnsZeroLengthArray() throws MalformedInputException
    {
        Assert.assertEquals(InputUtilities.getWords("", false).length, 0);
        Assert.assertEquals(InputUtilities.getWords("", true).length, 0);
    }

    @Test
    public void getWords_Whitespace_ReturnsZeroLengthArray() throws MalformedInputException
    {
        Assert.assertEquals(InputUtilities.getWords("    ", false).length, 0);
        Assert.assertEquals(InputUtilities.getWords("    ", true).length, 0);
    }

    public void getWords_PlainWords_ReturnsStringArray() throws MalformedInputException
    {
        String [] tokens = { "hello", ",", "world" };
        Assert.assertEquals(InputUtilities.getWords("hello , world", false), tokens);
    }
}

@@ -244,37 +244,37 @@
 throws Malformed
-Parse
+Input
 Exception%0A    %7B%0A
@@ -431,37 +431,37 @@
 throws Malformed
-Parse
+Input
 Exception%0A    %7B%0A
@@ -625,37 +625,37 @@
 throws Malformed
-Parse
+Input
 Exception%0A    %7B%0A
@@ -767,37 +767,37 @@
 ns = %7B Malformed
-Parse
+Input
 Exception.class 
@@ -867,37 +867,37 @@
 throws Malformed
-Parse
+Input
 Exception%0A    %7B%0A
@@ -996,37 +996,37 @@
 ns = %7B Malformed
-Parse
+Input
 Exception.class 
@@ -1105,21 +1105,21 @@
 alformed
-Parse
+Input
 Exceptio
@@ -1727,24 +1727,31 @@
  0);%0A    %7D%0A%0A
+%09@Test%0A
     public v
@@ -1978,10 +1978,12 @@
 ;%0A    %7D%0A
+%0A
 %7D%0A
+%0A

fix exceptions