Поправил checkSavingForAllMapStoreTest.

This commit is contained in:
psemenkov 2023-01-19 10:26:17 +03:00
parent e00969fa4b
commit 4616e5c735
2 changed files with 13 additions and 7 deletions

View file

@ -14,7 +14,7 @@ public class BusinessObjectAndBusinessEventForCheckMapStore<T> {
public final Matcher<T> MATCHER; public final Matcher<T> MATCHER;
private final String mapName; private final String mapName;
private final Class<T> clazz; private final Class<T> clazz;
private SettingOperation settingOperation; private SettingOperation[] settingOperations;
private SpcexObjectBase predictableObj; private SpcexObjectBase predictableObj;
@ -24,10 +24,10 @@ public class BusinessObjectAndBusinessEventForCheckMapStore<T> {
this.MATCHER = usingIgnoringFieldsComparator(); this.MATCHER = usingIgnoringFieldsComparator();
} }
public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class<T> clazz, SettingOperation settingOperation) { public BusinessObjectAndBusinessEventForCheckMapStore(String mapName, Class<T> clazz, SettingOperation... settingOperations) {
this.mapName = mapName; this.mapName = mapName;
this.clazz = clazz; this.clazz = clazz;
this.settingOperation = settingOperation; this.settingOperations = settingOperations;
this.MATCHER = usingIgnoringFieldsComparator(); this.MATCHER = usingIgnoringFieldsComparator();
} }
@ -54,10 +54,12 @@ public class BusinessObjectAndBusinessEventForCheckMapStore<T> {
} }
public void setPredictableObj(SpcexObjectBase predictableObj) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { public void setPredictableObj(SpcexObjectBase predictableObj) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
if (settingOperation != null) { if (settingOperations != null) {
for (SettingOperation settingOperation : settingOperations) {
Method method = clazz.getDeclaredMethod(settingOperation.getMethodName(), settingOperation.getParameterTypes()); Method method = clazz.getDeclaredMethod(settingOperation.getMethodName(), settingOperation.getParameterTypes());
method.invoke(predictableObj, settingOperation.getParams()); method.invoke(predictableObj, settingOperation.getParams());
} }
}
this.predictableObj = predictableObj; this.predictableObj = predictableObj;
} }

View file

@ -78,7 +78,11 @@ public class RunnableMapNamesForTesting {
new SettingOperation("setAmount", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("23.22")}))); new SettingOperation("setAmount", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("23.22")})));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserConnect, UserConnect.class)); businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_UserConnect, UserConnect.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_User, User.class)); businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_User, User.class));
businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_VerificationResult, VerificationResult.class)); businessObjectAndBusinessEventForCheckMapStores.add(new BusinessObjectAndBusinessEventForCheckMapStore<>(IMDGDistributedNames.Map_VerificationResult, VerificationResult.class,
new SettingOperation("setDiffSum", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("13.22")}),
new SettingOperation("setInSum", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("14.22")}),
new SettingOperation("setOutExtSum", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("15.22")}),
new SettingOperation("setOutIntSum", new Class[]{BigDecimal.class}, new Object[]{new BigDecimal("19.22")})));
//dictionary //dictionary
dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_AccountStatusDictionary, AccountStatusDictionary.class)); dictionaryObjectForCheckMapStores.add(new DictionaryObjectForCheckMapStore<>(IMDGDistributedNames.Map_AccountStatusDictionary, AccountStatusDictionary.class));