title: java.lang.AssertionError: expected
body: <p>My TestNG test implementation throws an error despite the expected value matches with the actual value.</p>
  
  <p>Here is the TestNG code:</p>
  
  <pre><code>@Test(dataProvider = "valid")
  public void setUserValidTest(int userId, String firstName, String lastName){
      User newUser = new User();
      newUser.setLastName(lastName);
      newUser.setUserId(userId);
      newUser.setFirstName(firstName);
      userDAO.setUser(newUser);
      Assert.assertEquals(userDAO.getUser().get(0), newUser);
  }
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code>java.lang.AssertionError: expected [UserId=10, FirstName=Sam, LastName=Baxt] but found [UserId=10,   FirstName=Sam, LastName=Baxt]
  </code></pre>
  
  <p>What have I done wrong here?</p>