title: Can't access public member variables from junit in Java
body: <p>Hi everybody my problem is the following:
  I want to write a testunit for a class i have written. For this I have the following Junit code:</p>
  
  <pre><code>  1 package ts;
    2 import ts.TransitionSystem;
    3 import ts.ConcreteTransitionSystem;
    4 import java.util.Set;
    5 import java.util.HashSet;
    6 import java.util.HashMap;
    7 
    8 import org.junit.Test;
    9 public class TransitionSystemTest {
   10 
   11   @Test
   12   public void addInitialTest () {
   13     TransitionSystem ts = new ConcreteTransitionSystem();
   14     ts.addInitialState("test");
   15     assertTrue(ts._initialStates.contains("test"));
   16     assertTrue(ts._states.get("s0").isEmpty());
   17   }
   18   
   19 }
  </code></pre>
  
  <p>my class looks as follows:</p>
  
  <pre><code>  1 package ts;
    2 
    3 import java.util.Set;
    4 import java.util.HashSet;
    5 import java.util.HashMap;
    6 import ts.TransitionSystem;
    7   
    8 public class ConcreteTransitionSystem implements TransitionSystem {
    9   Set&lt;String&gt; aps;
   10   HashMap&lt;String, Set&lt;String&gt;&gt; _states;
   11   Set&lt;String&gt; _initialStates;
   12 
   13   public void addInitialState(String s0) {
   14     Set&lt;String&gt; sucessors = new HashSet&lt;String&gt;();
   15     this._states.put(s0, sucessors);
   16     this._initialStates.add(s0);
   17   }
   18 }
  </code></pre>
  
  <p>and the error it get is the following:</p>
  
  <pre><code>TransitionSystemTest.java:15: error: cannot find symbol
      [javac]     assertTrue(ts._initialStates.contains("test"));
      [javac]                  ^
      [javac]   symbol:   variable _initialStates
      [javac]   location: variable ts of type TransitionSystem
  </code></pre>
  
  <p>and</p>
  
  <pre><code>TransitionSystemTest.java:16: error: cannot find symbol
      [javac]     assertTrue(ts._states.get("s0").isEmpty());
      [javac]                  ^
      [javac]   symbol:   variable _states
      [javac]   location: variable ts of type TransitionSystem
  </code></pre>
  
  <p>I cannot figure out the problem. Any ideas?</p>