@Test public void testContainsAllProperties() { final Map<String, String> props = new HashMap<String, String>(); props.put("test", "value"); final Map<String, String> props2 = new HashMap<String, String>(); props2.put("asdf", "value"); final Scope scope = new ScopeImpl("test", props); Assert.assertTrue(scope.containsAllProperties(props)); Assert.assertFalse(scope.containsAllProperties(props2)); }
@Override public boolean containsAllProperties(final Map<String, String> otherProperties) { for (final Entry<String, String> entry : otherProperties.entrySet()) { if (!this.properties.containsKey(entry.getKey())) { return false; } if (!this.getProperty(entry.getKey()).equals(entry.getValue())) { return false; } } return true; }
ScopeImpl implements Scope { @Override public boolean containsAllProperties(final Map<String, String> otherProperties) { for (final Entry<String, String> entry : otherProperties.entrySet()) { if (!this.properties.containsKey(entry.getKey())) { return false; } if (!this.getProperty(entry.getKey()).equals(entry.getValue())) { return false; } } return true; } }
ScopeImpl implements Scope { @Override public boolean containsAllProperties(final Map<String, String> otherProperties) { for (final Entry<String, String> entry : otherProperties.entrySet()) { if (!this.properties.containsKey(entry.getKey())) { return false; } if (!this.getProperty(entry.getKey()).equals(entry.getValue())) { return false; } } return true; } ScopeImpl(final String scopeName, final Map<String, String> properties); }
ScopeImpl implements Scope { @Override public boolean containsAllProperties(final Map<String, String> otherProperties) { for (final Entry<String, String> entry : otherProperties.entrySet()) { if (!this.properties.containsKey(entry.getKey())) { return false; } if (!this.getProperty(entry.getKey()).equals(entry.getValue())) { 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 containsAllProperties(final Map<String, String> otherProperties) { for (final Entry<String, String> entry : otherProperties.entrySet()) { if (!this.properties.containsKey(entry.getKey())) { return false; } if (!this.getProperty(entry.getKey()).equals(entry.getValue())) { 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);  }