20 package net.sf.gridarta.model.autojoin;
22 import java.util.ArrayList;
23 import java.util.List;
24 import java.util.regex.Pattern;
29 import org.jetbrains.annotations.NotNull;
30 import org.junit.Assert;
69 autojoinLists = mapModelCreator.getAutojoinLists();
79 final List<List<TestArchetype>> archetypes =
new ArrayList<>();
80 for (
final String archetypeNameList : archetypeNames) {
81 final List<TestArchetype> archetypeList =
new ArrayList<>();
82 if (!archetypeNameList.isEmpty()) {
83 for (
final String archetypeName : ALTERNATIVES_PATTERN.split(archetypeNameList, -1)) {
84 archetypeList.add(mapModelCreator.
getArchetype(archetypeName));
87 archetypes.add(archetypeList);
97 public void newAutojoinListsFail(@NotNull
final String expectedException, @NotNull
final String... archetypeNames) {
102 Assert.assertEquals(expectedException, ex.getMessage());
Helper class for regression tests to create MapModel instances.
Implements AutojoinList related functions.
void newAutojoinListsFail(@NotNull final String expectedException, @NotNull final String... archetypeNames)
Creates a new AutojoinLists instance and expects an error.
A MapArchObject implementation for testing purposes.
Contains a list of (typically wall-)arches which do autojoining.
Base package of all Gridarta classes.
final TestMapModelCreator mapModelCreator
The TestMapModelCreator instance.
GameObjects are the objects based on Archetypes found on maps.
Exception thrown if an AutojoinList is invalid.
final AutojoinLists< TestGameObject, TestMapArchObject, TestArchetype > autojoinLists
The AutojoinLists instance.
void addAutojoinList(@NotNull final AutojoinList< G, A, R > autojoinList)
Adds a new autojoin list.
TestArchetype getArchetype(@NotNull final String archetypeName)
Returns an archetype.
static final Pattern ALTERNATIVES_PATTERN
A Pattern that matches alternative archetypes.
AutojoinListsHelper(@NotNull final TestMapModelCreator mapModelCreator)
Creates a new instance.
void newAutojoinLists(@NotNull final String... archetypeNames)
Creates a new AutojoinLists instance.
Manages a mapping between archetypes to AutojoinLists.
An Archetype implementation for testing purposes.
A GameObject implementation for testing purposes.
AutojoinListsHelper()
Creates a new instance.