AI, tests: added testable use cases for getMultiAmount dialogs (part of #13638, #13766)

This commit is contained in:
Oleg Agafonov 2025-06-27 17:50:50 +04:00
parent a47c5726ec
commit b66912ea44
3 changed files with 67 additions and 22 deletions

View file

@ -10,21 +10,45 @@ import java.util.List;
*/
public class MultiAmountTestableResult extends BaseTestableResult {
List<Integer> values = new ArrayList<>();
List<Integer> selectedValues;
public void onFinish(String resDebugSource, boolean status, List<String> info, List<Integer> values) {
boolean aiAssertEnabled = false;
List<Integer> aiAssertValues = new ArrayList<>();
public void onFinish(String resDebugSource, boolean status, List<String> info, List<Integer> selectedValues) {
this.onFinish(resDebugSource, status, info);
this.values = values;
this.selectedValues = selectedValues;
}
@Override
public String getResAssert() {
return null; // TODO: implement
if (!this.aiAssertEnabled) {
return null;
}
// not finished
if (this.selectedValues == null) {
return null;
}
// wrong selection
String selected = this.selectedValues.toString();
String need = this.aiAssertValues.toString();
if (!selected.equals(need)) {
return String.format("Wrong selection: need %s, but get %s",
need,
selected
);
}
// all fine
return "";
}
@Override
public void onClear() {
super.onClear();
this.values.clear();
this.selectedValues = null;
}
}