@Test public void testEquals() { final PackageItem packageItem = new PackageItem("", PackageItem.DEFAULT_PACKAGE_NAME); assertTrue( packageItem .equals(packageItem)); assertTrue( new PackageItem("", PackageItem.DEFAULT_PACKAGE_NAME) .equals(new PackageItem("", PackageItem.DEFAULT_PACKAGE_NAME))); assertTrue( new PackageItem("org.test", "org.test") .equals(new PackageItem("org.test", "org.test"))); assertFalse( new PackageItem("", PackageItem.DEFAULT_PACKAGE_NAME) .equals("not package item")); assertFalse( new PackageItem("org.test", "org.test") .equals(new PackageItem("", PackageItem.DEFAULT_PACKAGE_NAME))); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof PackageItem)) { return false; } PackageItem aPackage = (PackageItem) o; if (!caption.equals(aPackage.caption)) { return false; } return packageName.equals(aPackage.packageName) && caption.equals(aPackage.caption); }
PackageItem { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof PackageItem)) { return false; } PackageItem aPackage = (PackageItem) o; if (!caption.equals(aPackage.caption)) { return false; } return packageName.equals(aPackage.packageName) && caption.equals(aPackage.caption); } }
PackageItem { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof PackageItem)) { return false; } PackageItem aPackage = (PackageItem) o; if (!caption.equals(aPackage.caption)) { return false; } return packageName.equals(aPackage.packageName) && caption.equals(aPackage.caption); } PackageItem();  PackageItem(final String packageName,
                       final String caption); }
PackageItem { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof PackageItem)) { return false; } PackageItem aPackage = (PackageItem) o; if (!caption.equals(aPackage.caption)) { return false; } return packageName.equals(aPackage.packageName) && caption.equals(aPackage.caption); } PackageItem();  PackageItem(final String packageName,
                       final String caption); String getPackageName(); String getCaption(); @Override boolean equals(Object o); @Override int hashCode(); }
PackageItem { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof PackageItem)) { return false; } PackageItem aPackage = (PackageItem) o; if (!caption.equals(aPackage.caption)) { return false; } return packageName.equals(aPackage.packageName) && caption.equals(aPackage.caption); } PackageItem();  PackageItem(final String packageName,
                       final String caption); String getPackageName(); String getCaption(); @Override boolean equals(Object o); @Override int hashCode(); static final String DEFAULT_PACKAGE_NAME; }