0
想知道如何爲以下代碼編寫UT代碼嗎?想知道如何爲以下代碼編寫UT代碼嗎?
public Set<OMEntity> applyInitialDump(Map<Class<? extends Entity>, List<Entity>> centralModelRelated) {
try {
return _executionUnit.executeSynch(new ApplyInitialDumpOnCentralModel(_context, centralModelRelated));
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
我嘗試嘲笑_executionUnit,但如何嘲笑參數(ApplyInitialDumpOnCentralModel)?謝謝。
附上一些測試代碼供參考。
Map<Class<? extends Entity>,List<Entity>> centralModelRelated = new HashMap<Class<? extends Entity>, List<Entity>>();
CentralModelUnitOfWork unitOfWork = new ApplyInitialDumpOnCentralModel(omContext, centralModelRelated);
executionUnit = EasyMock.createMock(ExecutionUnit.class);
EasyMock.expect(executionUnit.executeSynch(??????????)).andReturn(new Object()).once();;
EasyMock.replay(executionUnit);
centralModel.applyInitialDump(centralModelRelated);