@Override
    public boolean matches(Object o) {

      if (!(o instanceof Set)) {
        return false;
      }

      Set set = (Set) o;

      if (set.size() != 1) {
        return false;
      }

      Object request = set.iterator().next();

      return request instanceof UserRequest &&
          eq(((UserRequest) request).getUsername(), userRequest.getUsername());
    }
Matcher for a UserRequest set containing a single request.
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractResourceProviderTest.java