title: assertEquals(obj,obj) returns a failed test
body: <p>Hmm, I have a money object that allows me to add other money objects into it.
  I tried <code>assertEquals()</code> in java for testing out if my code if okay, but then it failed.</p>
  
  <p>I'm very positive that my code is correct (<code>System.out.println</code> returns the correct answer), I think I'm just using <code>assertEquals</code> in the wrong manner. T_T</p>
  
  <p>What exactly do I use if I want to find out if <code>myObj1 == myObj2</code> for the tests?</p>
  
  <pre><code>**in my test.java**    
  assertEquals(new Money(money1.getCurrency(),new Value(22,70)),money1.add(money2));
  
  **in my money class**
  public class Money {
      Currency currency;
      Value value;
  
      //constructor for Money class
      public Money(Currency currency, Value value) {
          super();
          this.currency = currency;
          this.value = value;
      }
  
      public Currency getCurrency() {
          return currency;
      }
  
      public void setCurrency(Currency currency) {
          this.currency = currency;
      }
  
      //must have same currency
      public Money add(Money moneyToBeAdded){
          Money result = new Money(moneyToBeAdded.currency, new Value(0,0));
          Value totalInCents;
          int tempCents;
          int tempDollars;
  
          if(compareCurrency(moneyToBeAdded)){
              totalInCents = new Value(0,moneyToBeAdded.value.toCents()+value.toCents());
              tempDollars = (totalInCents.toDollars().getDollar());
              tempCents = (totalInCents.toDollars().getCents());
  
              result = new Money(moneyToBeAdded.currency, new Value(tempDollars,tempCents));
              System.out.println(result.value.getDollar()+"."+result.value.getCents());
          }
          return result;
      }
  
      private boolean compareCurrency(Money money){
          return (money.currency.equals(currency))? true : false;
      }
  }
  </code></pre>