title: Comparing dates with JUnit testing
body: <p>Hello I'm new to the site and have a issue with my application using JUnit testing. My issue is when I try to compare the Date method with itself it always fails. I printed the Date object in the test to see the problem and always end up with the package name and random letters. Here is the Date constructor:</p>
  
  <pre><code>public class Date
  {
  SimpleDateFormat dformat = new SimpleDateFormat("dd-MM-yyyy");
  
  private int day;
  private int month;
  private int year;
  
  public Date() 
  {
      String today;
      Calendar present = Calendar.getInstance();
  
      day = present.get(Calendar.DAY_OF_MONTH);
      month = present.get(Calendar.MONTH);
      year = present.get(Calendar.YEAR);
  
      present.setLenient(false);
      present.set(year, month - 1, day, 0, 0);
  
      today = dformat.format(present.getTime());
      System.out.println(today);
  }
  </code></pre>
  
  <p>Here is my test:</p>
  
  <pre><code>@Test 
  public void currentDay()
  {
      Date current = new Date();
      System.out.println(current);
      assertEquals("today:", current, new Date());
  }
  </code></pre>
  
  <p>Yet the result always fails and I get something on  the lines of:</p>
  
  <pre><code>comp.work.wk.Date@d3ade7
  </code></pre>
  
  <p>Any help would be appreciated.</p>