title: assertion error in junit test in java
body: <p>guys i have this service</p>
  
  <pre><code>public class DepartmentServiceImpl implements DepartmentService {
  
      @Autowired
      private DepartmentDao departmentDao;
      //... other functions 
  
      @Override
      public Department getDepartment(int depid) {
          return departmentDao.getDepartment(depid);
      }
  }
  </code></pre>
  
  <p>and my test unit is </p>
  
  <pre><code>Department department = new Department();
  
  @Autowired
  private DepartmentDao myDao;
  
  @Autowired
  private DepartmentService service;
  
  
  @Test
  public void testGetDepartment(){
      department.setDepId(111);
      department.setDepName("merna");
      assertEquals(department, service.getDepartment(111));
  }
  </code></pre>
  
  <p>but it gives me</p>
  
  <pre><code>java.lang.AssertionError: expected:&lt;com.dineshonjava.model.Department@f9b5552&gt; but was:&lt;com.dineshonjava.model.Department@4d4960c8&gt;
  </code></pre>
  
  <p>any help  ??</p>