@Test
  public void testEquals() {
    Menu m1 = new Menu(name, description);
    assertTrue(m1.addItem(i1));
    assertTrue(m1.addItem(i2));

    Menu m2 = new Menu(name, description);
    assertTrue(m2.addItem(i1));
    assertTrue(m2.addItem(i2));

    assertTrue(m1.equals(m2));
  }
Example #2
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   final TemplateMenu other = (TemplateMenu) obj;
   if (id == null) {
     if (other.id != null) return false;
   } else if (!id.equals(other.id)) return false;
   if (menu == null) {
     if (other.menu != null) return false;
   } else if (!menu.equals(other.menu)) return false;
   if (template == null) {
     if (other.template != null) return false;
   } else if (!template.equals(other.template)) return false;
   return true;
 }
  /* (non-Javadoc)
   * @see java.lang.Object#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null) return false;
    if (getClass() != obj.getClass()) return false;

    Affectation_menu other = (Affectation_menu) obj;

    if (id_menu == null) {
      if (other.id_menu != null) return false;
    } else if (!id_menu.equals(other.id_menu)) {
      return false;
    }

    if (id_profil == null) {
      if (other.id_profil != null) return false;
    } else if (!id_profil.equals(other.id_profil)) {
      return false;
    }

    return true;
  }