1 package civitas.util;
2
3 import java.io.PrintWriter;
4
5 import org.mockito.invocation.InvocationOnMock;
6 import org.mockito.stubbing.Answer;
7
8 public class XMLAnswer implements Answer<Void> {
9 String theXML;
10
11 public XMLAnswer(final String theXML) {
12 this.theXML = theXML;
13 }
14
15 @Override
16 public Void answer(final InvocationOnMock invocation) {
17 try (PrintWriter printWriter = (PrintWriter) invocation.getArguments()[1]) {
18 printWriter.append(theXML);
19 }
20 return null;
21 }
22 }