@Test public void testFilterWithSingleLevelReferences() { DescribeSObjectResult dsrIn = new DescribeSObjectResult(); dsrIn.setName("Object_Name_In__c"); DescribeSObjectResult dsrRef = new DescribeSObjectResult(); dsrRef.setName("RefObject__c"); Field refField = new Field(); refField.setName("RefField__c"); refField.setType(FieldType.reference); refField.setReferenceTo(new String[] {"RefObject__c"}); dsrIn.setFields(new Field[] {refField}); List<DescribeSObjectResult> dsrs = new ObjectNameWithRefFilter("Object_Name_In__c").filter(Lists.newArrayList(dsrIn, dsrRef)); assertNotNull(dsrs, "An object name with references filter of a non-null value should be non-null"); assertEquals(dsrs.size(), 2, "Unexpected number of DescribeSObjectResults after object name with references filter"); }
@Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { for (DescribeSObjectResult dsr : dsrs) { objectMap.put(dsr.getName(), dsr); } filterObjectAndReferences(objectNames); return filteredResult; }
ObjectNameWithRefFilter implements ObjectFilter { @Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { for (DescribeSObjectResult dsr : dsrs) { objectMap.put(dsr.getName(), dsr); } filterObjectAndReferences(objectNames); return filteredResult; } }
ObjectNameWithRefFilter implements ObjectFilter { @Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { for (DescribeSObjectResult dsr : dsrs) { objectMap.put(dsr.getName(), dsr); } filterObjectAndReferences(objectNames); return filteredResult; } ObjectNameWithRefFilter(Set<String> objectNames);  ObjectNameWithRefFilter(String... objectNames); }
ObjectNameWithRefFilter implements ObjectFilter { @Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { for (DescribeSObjectResult dsr : dsrs) { objectMap.put(dsr.getName(), dsr); } filterObjectAndReferences(objectNames); return filteredResult; } ObjectNameWithRefFilter(Set<String> objectNames);  ObjectNameWithRefFilter(String... objectNames); @Override List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs); }
ObjectNameWithRefFilter implements ObjectFilter { @Override public List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs) { for (DescribeSObjectResult dsr : dsrs) { objectMap.put(dsr.getName(), dsr); } filterObjectAndReferences(objectNames); return filteredResult; } ObjectNameWithRefFilter(Set<String> objectNames);  ObjectNameWithRefFilter(String... objectNames); @Override List<DescribeSObjectResult> filter(List<DescribeSObjectResult> dsrs);  }