webMethods 10.2 | Unit Test Framework | Mocks | Sample Mock Factory
 
Sample Mock Factory
The following code snippet illustrates the minimum requirements for creating a mock factory. The factory class and any other classes should be designed to evaluate the input data to the factory and return data relevant to that input in an IData format. The example below returns static data.
package com.wm.ps.serviceMock.samples;

import com.wm.app.b2b.server.BaseService;
import com.wm.app.b2b.server.invoke.ServiceStatus;
import com.wm.data.IData;
import com.wm.data.IDataFactory;
import com.wm.ps.serviceMock.MockDataFactory;

public class SampleMockDataFactory implements MockDataFactory
{
private static final long serialVersionUID = 2L;

public IData createData(BaseService baseService, IData pipeline, ServiceStatus serviceStatus)
{
IData[] results = new IData[]{IDataFactory.create(new Object[][]{
{"originationSource","W"},
{"bizType","RT"},
{"lockExpirationDate","20050427"},
{"floatLoanIndicator","Y"},
{"uwFinalDecisionCode","0"},
{"uwDecisionExpiryDate","20050427"},
{"canDate","20050427"},
{"loanCloseStatusType","T"},
{"fileReceivedAtRocDate","20050221"},
{"loanReadyToFundIndicator","P"},
{"regisDate","20051221"},
{"loanSubmitToUwDate","20050427"},
{"loanNumber","0000000001"},
{"branch","TOTAL ADVANTEDGE LLC "},
{"underwritingDecisionCode","0"},
{"underwritingDecisionExpirationDate","20050427"},
{"lockDate","20051220"},
{"lockIndicator","Y"},
{"tmoLoanStageCode","3"},
{"tmoLoanStageDate","20050427"},
{"product","C30 "},
{"borrowerFirstName",". "},
{"borrowerLastName","XX "},
{"propertyAddress","937 S MEYER "},
{"propertyCity","TUCSON "},
{"propertyState","AZ"},
{"propertyZip","85701"}
})};

IData output = IDataFactory.create(new Object[][]{{"results", results}});
return IDataFactory.create(new Object[][]{{"getPotentialDuplicatesOutput", output}});
}
}

Copyright © 2017-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release