public boolean isSetByUser(PropertyKey key) {
    if (mUserProps.containsKey(key)) {
      Optional<Object> val = mUserProps.get(key);
      // Sources larger than Source.CLUSTER_DEFAULT are considered to be set by the user
      return val.isPresent() && (getSource(key).compareTo(Source.CLUSTER_DEFAULT) > 0);
    }
    return false;
  }
@Test
  public void isSetByUser() {
    assertFalse(mProperties.isSetByUser(mKeyWithValue));
    assertFalse(mProperties.isSetByUser(mKeyWithoutValue));
    mProperties.put(mKeyWithValue, "value", Source.CLUSTER_DEFAULT);
    mProperties.put(mKeyWithoutValue, "value", Source.CLUSTER_DEFAULT);
    assertFalse(mProperties.isSetByUser(mKeyWithValue));
    assertFalse(mProperties.isSetByUser(mKeyWithoutValue));
    // Sources larger than Source.CLUSTER_DEFAULT are considered to be set by the user
    mProperties.put(mKeyWithValue, "value", Source.SYSTEM_PROPERTY);
    mProperties.put(mKeyWithoutValue, "value", Source.SYSTEM_PROPERTY);
    assertTrue(mProperties.isSetByUser(mKeyWithValue));
    assertTrue(mProperties.isSetByUser(mKeyWithoutValue));
    mProperties.remove(mKeyWithValue);
    assertFalse(mProperties.isSetByUser(mKeyWithValue));
  }