title: How to test a class only with public getters and private setters with JUnit?
body: <p>Lets say we have following class:</p>
  
  <pre><code> package com.porphyrie.examples;
  
  public class TestExample {
  
      private String name;
      private int id;
  
      public TestExample() {
          setName("testExample");
          setId(3); 
      }
  
  
      public String getName() {
          return name;
      }
      private void setName(String name) {
          this.name = name;
      }
      public int getId() {
          return id;
      }
      private void setId(int id) {
          this.id = id;
      }
  
  }
  </code></pre>
  
  <p>How should I test this class? Since eclipse wants only to test the public methods, how I should test the getters without setting the setters? Is it valid to set the <code>private</code> setter-methods in the class above to <code>public</code> only for testing purposes?</p>
  
  <p>Thanks for any help...</p>