title: Why .equals method is failing on two same value objects?
body: <p>I have created a value object <code>MarketVO</code> and two instances of this value object have same elements and same value for each element. </p>
  
  <p>My value object class is:</p>
  
  <pre><code>public class MarketVO {
  
      private double floatAmt;
      private Date marketDate;
      private long marketCap;
  }
  </code></pre>
  
  <p>Here are the values:</p>
  
  <p>returnedData:</p>
  
  <pre><code>FloatAmt: 247657.5418618201, MarketCap: 5249164,
  MarketDate: 2011-07-29 00:00:00.0 
  </code></pre>
  
  <p>expectedData:</p>
  
  <pre><code>FloatAmt: 247657.5418618201, MarketCap: 5249164, 
  MarketDate: 2011-07-29 00:00:00.0
  </code></pre>
  
  <p>Now in my unit test class, I want to assert that my returned and expected type is same containing same value in same order so am doing something like </p>
  
  <p><code>assertTrue(returnedData.equals(expectedData))</code>, now this is returning <code>false</code> value but if I do </p>
  
  <pre><code>assertEquals(testObject.getfloatAmt(), testObject2.getfloatAmt());
  assertEquals(testObject.getmarketCap(), testObject2.getmarketCap());
  assertEquals(testObject.getmarketDate(), testObject2.getmarketDate());
  </code></pre>
  
  <p>this test passes and so am not sure as to why <code>.equals</code> method is not working in here? Any suggestions?</p>
  
  <p><strong>Update:</strong> I want to put emphasize here that we are using this for doing <strong><em>Unit Testing</em></strong>. </p>