title: How Should I write JUnit test in the following case?
body: <p>I am new in the Unit Testing.
  I have a class <code>Ckeckout</code> which main function is to print the amount to be paid for books. The user types the titles of the books in the command line, and based on some calculations I have to output the final price.
  Here is the <code>Book</code> class:</p>
  
  <pre><code>public class Book {
      private String title;
      private double price;
      private int year;
  
      public Book(String title, double price, int year) {
          super();
          this.title = title;
          this.price = price;
          this.year = year;
      }
  }
  </code></pre>
  
  <p>And here is the <code>Checkout</code> class:</p>
  
  <pre><code>public class Checkout {
  
      private List&lt;Book&gt; books;
  
      public Checkout(List&lt;Book&gt; books) {
          super();
          this.books = books;
      }
  
      //calculate the final price
      private double getPrice(){
          //return some double
      }
  
  
  }
  </code></pre>
  
  <p>What I want to test is just <code>getPrice</code> method. However, to do so, do I have to create list of <code>Book</code> objects in my <code>CheckoutTest</code>? Also, I will have to verify the final result with some very long number (like 62.01997301). Isn't it easier, to test the main() method, since in my Unit test, there won't be any need to create the <code>Book</code> objects (I will work only with <code>Strings</code>) and I can verify the output with shorter number (like 62.01)? </p>