### Question:
BasicRequestCtx implements RequestCtx { @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BasicRequestCtx other = (BasicRequestCtx) obj; if (action == null) { if (other.action != null) return false; } else if (!action.equals(other.action)) { return false; } if (environment == null) { if (other.environment != null) return false; } else if (!environment.equals(other.environment)) { return false; } if (resource == null) { if (other.resource != null) return false; } else if (!resource.equals(other.resource)) { return false; } if (resourceContent == null) { if (other.resourceContent != null) return false; } else if (!resourceContent.equals(other.resourceContent)) { return false; } if (subjects == null) { if (other.subjects != null) return false; } else if (!subjects.equals(other.subjects)) { return false; } return true; } BasicRequestCtx(List<Subject> subjects, List<Attribute> resource, List<Attribute> action,
                      List<Attribute> environment);  BasicRequestCtx(Set<Subject> subjects, Set<Attribute> resource, Set<Attribute> action, 
                      Set<Attribute> environment, Node documentRoot);  BasicRequestCtx(List<Subject> subjects, List<Attribute> resource, List<Attribute> action, 
                      List<Attribute> environment, Node documentRoot);  BasicRequestCtx(Set<Subject> subjects, Set<Attribute> resource, Set<Attribute> action, 
                      Set<Attribute> environment, String resourceContent);  BasicRequestCtx(Set<Subject> subjects, Set<Attribute> resource, 
            Set<Attribute> action, Set<Attribute> environment, Node documentRoot,
            String resourceContent);  BasicRequestCtx( List<Subject> subjects, List<Attribute> resource,
                      List<Attribute> action, List<Attribute> environment, Node documentRoot,
                      String resourceContent); static RequestCtx getInstance(Node root); static RequestCtx getInstance(InputStream input); @Override Set getSubjects(); @Override Set getResource(); @Override Set getAction(); @Override Set getEnvironmentAttributes(); @Override List<Subject> getSubjectsAsList(); @Override List<Attribute> getResourceAsList(); @Override List<Attribute> getActionAsList(); @Override List<Attribute> getEnvironmentAttributesAsList(); @Override Node getDocumentRoot(); @Override void encode(OutputStream output); @Override void encode(OutputStream output, String nsURI); @Override void encode(OutputStream output, Indenter indenter); @Override void encode(OutputStream output, Indenter indenter, String nsURI); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void testEquals() throws ParsingException { List<Subject> subjects = Collections.singletonList(fixtureSubject); List<Attribute> action = Collections.emptyList(); List<Attribute> environment = Collections.emptyList(); List<Attribute> resource = Arrays.asList(new Attribute[]{ AbstractPolicyEnforcementPoint.RESOURCE_ATTRIBUTE, new SingletonAttribute(Constants.OBJECT.PID.attributeId, null, null, new StringAttribute("foo:bar")) }); RequestCtx actual = new BasicRequestCtx(subjects, resource, action, environment); assertFalse(test.equals(actual)); resource = Arrays.asList(new Attribute[]{ AbstractPolicyEnforcementPoint.RESOURCE_ATTRIBUTE, new SingletonAttribute(Constants.OBJECT.PID.attributeId, null, null, new StringAttribute("lol:wut")) }); actual = new BasicRequestCtx(subjects, resource, action, environment); assertTrue(test.equals(actual)); }