コード例 #1
0
 @BeforeMethod
 public void setUp() throws SaxonApiException {
   MockitoAnnotations.initMocks(this);
   given(processorFactory.createProcessor()).willReturn(processor);
   given(processor.newXQueryCompiler()).willReturn(xQueryCompiler);
   given(xQueryCompiler.compile(QUERY)).willReturn(xQueryExecutable);
   given(xQueryExecutable.load()).willReturn(xQueryEvaluator);
   given(inputSourceFactory.createInputSource(INPUT)).willReturn(inputSource);
   given(saxSourceFactory.createSAXSource(inputSource)).willReturn(saxSource);
   given(byteArrayOutputStreamFactory.createByteArrayOutputStream()).willReturn(outputStream);
 }
コード例 #2
0
  @BeforeMethod
  public void setUp() throws SAXException {
    underTest = Mockito.spy(new SequenceAwareXslTransformer());
    MockitoAnnotations.initMocks(this);
    given(processorFactory.createProcessor()).willReturn(processor);
    doReturn(xmlReader).when(underTest).createXMLReader();

    Map<String, String> historyEntries = new HashMap<>();
    historyEntries.put("historyRequest", "historyRequestContent");
    historyEntries.put("historyResponse", "historyResponseContent");

    given(nameToXml.entrySet()).willReturn(historyEntries.entrySet());
  }