title: Unit Testing Concrete Methods in an Abstract Class
body: <p>Suppose I want to unit test the following abstract class:</p>
  
  <pre class="lang-java prettyprint-override"><code>abstract class Fruit {
  
    private int calories;
  
    public Fruit(int calories) {
      this.calories = calories;
    }
  
    int getCalories() {
      return this.calories;
    }
  
    double getKilojoules() {
      return this.calories * 4.184;
    }
  }
  </code></pre>
  
  <p>I agree that abstract classes and interfaces should not be tested - their implementations should, but what about concretely defined methods like simple getters like <code>getCalories()</code>?</p>
  
  <p>Now some say that simple methods like getters should not be tested, but even then: what about methods like <code>getKilojoules()</code>?</p>