@Test public void testEqualsIncludesPropertiesAndName() { final Map<String, String> props = new HashMap<String, String>(); props.put("test", "value"); final Scope scope = new ScopeImpl("test", props); final Scope notEqualScope1 = new ScopeImpl("test", Collections.<String, String> emptyMap()); final Scope notEqualScope2 = new ScopeImpl("test2", props); final Scope equalScope = new ScopeImpl("test", props); Assert.assertEquals(scope, equalScope); Assert.assertFalse(scope.equals(notEqualScope1)); Assert.assertFalse(scope.equals(notEqualScope2)); }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ScopeImpl other = (ScopeImpl) obj; if (properties == null) { if (other.properties != null) { return false; } } else if (!properties.equals(other.properties)) { return false; } if (scopeName == null) { if (other.scopeName != null) { return false; } } else if (!scopeName.equals(other.scopeName)) { return false; } return true; }
ScopeImpl implements Scope { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ScopeImpl other = (ScopeImpl) obj; if (properties == null) { if (other.properties != null) { return false; } } else if (!properties.equals(other.properties)) { return false; } if (scopeName == null) { if (other.scopeName != null) { return false; } } else if (!scopeName.equals(other.scopeName)) { return false; } return true; } }
ScopeImpl implements Scope { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ScopeImpl other = (ScopeImpl) obj; if (properties == null) { if (other.properties != null) { return false; } } else if (!properties.equals(other.properties)) { return false; } if (scopeName == null) { if (other.scopeName != null) { return false; } } else if (!scopeName.equals(other.scopeName)) { return false; } return true; } ScopeImpl(final String scopeName, final Map<String, String> properties); }
ScopeImpl implements Scope { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ScopeImpl other = (ScopeImpl) obj; if (properties == null) { if (other.properties != null) { return false; } } else if (!properties.equals(other.properties)) { return false; } if (scopeName == null) { if (other.scopeName != null) { return false; } } else if (!scopeName.equals(other.scopeName)) { return false; } return true; } ScopeImpl(final String scopeName, final Map<String, String> properties); @Override String getProperty(final String key); @Override Map<String, String> getProperties(); @Override String getName(); @Override int hashCode(); @Override boolean equals(final Object obj); @SuppressWarnings("nls") @Override String toString(); @Override boolean containsAllProperties(final Map<String, String> otherProperties); }
ScopeImpl implements Scope { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ScopeImpl other = (ScopeImpl) obj; if (properties == null) { if (other.properties != null) { return false; } } else if (!properties.equals(other.properties)) { return false; } if (scopeName == null) { if (other.scopeName != null) { return false; } } else if (!scopeName.equals(other.scopeName)) { return false; } return true; } ScopeImpl(final String scopeName, final Map<String, String> properties); @Override String getProperty(final String key); @Override Map<String, String> getProperties(); @Override String getName(); @Override int hashCode(); @Override boolean equals(final Object obj); @SuppressWarnings("nls") @Override String toString(); @Override boolean containsAllProperties(final Map<String, String> otherProperties);  }