forked from External/mage
tests: improved testable dialogs (added assert messages in result table, added single dialog debugging, part of #13643, #13638);
This commit is contained in:
parent
7a44ee2a97
commit
4732fdf527
10 changed files with 166 additions and 53 deletions
|
|
@ -8,8 +8,10 @@ import mage.constants.Outcome;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -55,7 +57,7 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
public class TestableDialogsRunner {
|
||||
|
||||
private final List<TestableDialog> dialogs = new ArrayList<>();
|
||||
private final Map<Integer, TestableDialog> dialogs = new LinkedHashMap<>();
|
||||
|
||||
static final int LAST_SELECTED_GROUP_ID = 997;
|
||||
static final int LAST_SELECTED_DIALOG_ID = 998;
|
||||
|
|
@ -79,12 +81,14 @@ public class TestableDialogsRunner {
|
|||
}
|
||||
|
||||
void registerDialog(TestableDialog dialog) {
|
||||
this.dialogs.add(dialog);
|
||||
Integer regNumber = this.dialogs.size() + 1;
|
||||
dialog.setRegNumber(regNumber);
|
||||
this.dialogs.put(regNumber, dialog);
|
||||
}
|
||||
|
||||
public void selectAndShowTestableDialog(Player player, Ability source, Game game, Player opponent) {
|
||||
// select group or fast links
|
||||
List<String> groups = this.dialogs.stream()
|
||||
List<String> groups = this.dialogs.values().stream()
|
||||
.map(TestableDialog::getGroup)
|
||||
.distinct()
|
||||
.sorted()
|
||||
|
|
@ -201,8 +205,8 @@ public class TestableDialogsRunner {
|
|||
return choice;
|
||||
}
|
||||
|
||||
public List<TestableDialog> getDialogs() {
|
||||
return this.dialogs;
|
||||
public Collection<TestableDialog> getDialogs() {
|
||||
return this.dialogs.values();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue