asserts for strings in Junit
<p>I think I'm screwing something up. I have this code in my JUnit test class:</p>

<pre><code>    import static org.junit.Assert.*;

    import java.util.ArrayList;

    import org.junit.After;
    import org.junit.AfterClass;
    import org.junit.Before;
    import org.junit.BeforeClass;
    import org.junit.Test;


    public class HangmanLogicTest {

ArrayList&lt;Integer&gt; negIntList = new ArrayList&lt;Integer&gt;();
ArrayList&lt;Integer&gt; intList = new ArrayList&lt;Integer&gt;();

HangmanLogic hl = new HangmanLogic();

String booty = "b----";


// creates a list of integers from 1 to 10000
private void makePosInts()
{

    int min = 1;
    int max = 10000;
    for (int i = min; i &lt;= max; i++) {
        intList.add(i);
    }
}


// testing the constructor to see if it will accept valid strings 
@Test
public void testString_HangmanLogic() throws InvalidConfigurationException {

    for (String i : FileReader.validWords) { // FileReader.validWords is a list of all valid words
        HangmanLogic h = new HangmanLogic(i, 1);
    }
}

// testing the constructor to see if it will accept valid integers 
@Test
public void testInt_HangmanLogic() throws InvalidConfigurationException {

    for (int i : intList) { 
        HangmanLogic h = new HangmanLogic("booty", i);
    }
}

// testing the constructor to see if it will throw exception for null string parameter
@Test(expected = InvalidConfigurationException.class)
public void testNullStringException_HangmanLogic() throws InvalidConfigurationException {

    HangmanLogic h = new HangmanLogic(nullString, 1);

}

// testing the constructor to see if it will throw exception for empty string parameter
@Test(expected = InvalidConfigurationException.class)
public void testEmptyStringException_HangmanLogic() throws InvalidConfigurationException {
    HangmanLogic h = new HangmanLogic("", 1);
}


// testing the constructor to see if it will throw an exception for 0 in the int parameter
@Test(expected = InvalidConfigurationException.class)
public void test0Exception_HangmanLogic() throws InvalidConfigurationException {
    HangmanLogic h = new HangmanLogic("booty", 0);
}

// testing the constructor to see if it will throw an exception for negative integer parameters
@Test(expected = InvalidConfigurationException.class)
public void testNegIntException_HangmanLogic() throws InvalidConfigurationException {


        HangmanLogic h = new HangmanLogic("booty", (-1));


}


// testing getKnownKeyPhrase() to see if the if conditional works at HangmanLogic line 55
@Test
public void testIf_getKnownKeyPhrase() throws InvalidConfigurationException{

    hl.keyPhrase = "booty";
    HangmanLogic.guessedCharacters.add('b');
    assertTrue(hl.getKnownKeyPhrase().equals("b----"));

}

// testing
</code></pre>

<p>}</p>

<p>The method getKnownKeyPhrase() is the following code:</p>

<pre><code>public String getKnownKeyPhrase()
{
    char[] encodedKeyPhrase = new char[keyPhrase.length()];
    String lowerCaseKeyPhrase = keyPhrase.toLowerCase();

    for(int i = 0; i &lt; keyPhrase.length(); i++)
    {
        char cur = lowerCaseKeyPhrase.charAt(i);
        if(guessedCharacters.contains(cur))
            encodedKeyPhrase[i] = cur;
        else
            encodedKeyPhrase[i] = '-';
    }

    return (new String(encodedKeyPhrase) );
}
</code></pre>

<p>where encodedKeyPhrase is a char array that looks like this {b,-,-,-,-}</p>

<p>this is the error trace:</p>

<pre><code>java.lang.NullPointerException
at HangmanLogicTest.testIf_getKnownKeyPhrase(HangmanLogicTest.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
</code></pre>

<p>I keep getting a null pointer error. </p>

<p>What am I doing wrong? </p>

<p>Thanks!</p>
