### Question:
PipelinedData { public Batch getBatch(Expressions expressions, ELResolver rootObjects) { return getBatch(expressions, rootObjects, allPreloads); } PipelinedData(Element element, Uri base); private  PipelinedData(PipelinedData socialData, Substitutions substituter); PipelinedData substitute(Substitutions substituter); Batch getBatch(Expressions expressions, ELResolver rootObjects); boolean needsViewer(); boolean needsOwner(); static final String OPENSOCIAL_NAMESPACE; static final String EXTENSION_NAMESPACE; }### Answer:
@Test public void testBatching() throws Exception { String xml = "<Content xmlns=\"" + PipelinedData.OPENSOCIAL_NAMESPACE + "\">" + "<PeopleRequest key=\"key\" userId=\"${userId}\"/>" + "<HttpRequest key=\"key2\" href=\"${key}\"/>" + "</Content>"; PipelinedData socialData = new PipelinedData(XmlUtil.parse(xml), GADGET_URI); PipelinedData.Batch batch = socialData.getBatch(expressions, elResolver); assertTrue(batch.getPreloads().isEmpty()); elValues.put("userId", "foo"); batch = batch.getNextBatch(elResolver); assertEquals(1, batch.getPreloads().size()); assertTrue(batch.getPreloads().containsKey("key")); elValues.put("key", "somedata"); batch = batch.getNextBatch(elResolver); assertEquals(1, batch.getPreloads().size()); assertTrue(batch.getPreloads().containsKey("key2")); assertNull(batch.getNextBatch(elResolver)); }
@Test public void badHrefTest() throws Exception { String xml = "<Content><HttpRequest xmlns=\"" + PipelinedData.OPENSOCIAL_NAMESPACE + "\" " + " key=\"key\"" + " href=\"/example.html%\"" + "/></Content>"; boolean foundException = false; try { PipelinedData pipelinedData = new PipelinedData(XmlUtil.parse(xml), GADGET_URI); PipelinedData.Batch batch = pipelinedData.getBatch(expressions, elResolver); } catch (RuntimeException e) { foundException = true; } assertTrue("found RuntimeException (for now) see SHINDIG-1090", foundException); }