20 package net.sf.gridarta.model.autojoin;
29 import org.junit.Assert;
30 import org.junit.Test;
47 autojoinListsHelper.
newAutojoinListsFail(
"autojoin list with less than 16 valid entries",
"a0",
"a1",
"a2",
"a3",
"a4",
"a5",
"a6",
"a7",
"a8",
"a9",
"a10",
"a11",
"a12",
"a13",
"a14");
48 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5",
"a6",
"a7",
"a8",
"a9",
"a10",
"a11",
"a12",
"a13",
"a14",
"a15");
49 autojoinListsHelper.
newAutojoinListsFail(
"autojoin list with more than 16 valid entries",
"a0",
"a1",
"a2",
"a3",
"a4",
"a5",
"a6",
"a7",
"a8",
"a9",
"a10",
"a11",
"a12",
"a13",
"a14",
"a15",
"a16");
61 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5",
"a6",
"a7",
"a8",
"a9",
"a10",
"a11",
"a12",
"a13",
"a14",
"a0");
71 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5",
"a6",
"a7",
"a8",
"a9",
"a10",
"a11",
"a12",
"a13",
"a14",
"a15");
72 autojoinListsHelper.
newAutojoinListsFail(
"archetype 'a4' contained in more than one autojoin list",
"b0",
"b1",
"b2",
"b3",
"a4",
"b5",
"b6",
"b7",
"b8",
"b9",
"b10",
"b11",
"b12",
"b13",
"b14",
"b15");
73 autojoinListsHelper.
newAutojoinListsFail(
"autojoin list contains duplicate archetype 'c0'",
"c0|c1|c0",
"c1",
"c2",
"c3",
"c4",
"c5",
"c6",
"c7",
"c8",
"c9",
"c10",
"c11",
"c12",
"c13",
"c14",
"c15");
74 autojoinListsHelper.
newAutojoinListsFail(
"autojoin list is empty",
"d0",
"d1",
"d2",
"",
"d4",
"d5",
"d6",
"d7",
"d8",
"d9",
"d10",
"d11",
"d12",
"d13",
"d14",
"d15");
86 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5",
"a6",
"a7",
"a8",
"a9",
"a10",
"a11",
"a12",
"a13",
"a14",
"a15");
105 }
catch (
final IllegalArgumentException ignored) {
128 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5",
"a6",
"a7",
"a8",
"a9",
"a10",
"a11",
"a12",
"a13",
"a14",
"a15");
164 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5|b5",
"a6",
"a7",
"a8",
"a9",
"a10|b10",
"a11",
"a12",
"a13",
"a14",
"a15");
193 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5|b5",
"a6",
"a7",
"a8",
"a9",
"a10|b10",
"a11",
"a12",
"a13",
"a14",
"a15");
221 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5|b5",
"a6",
"a7",
"a8",
"a9",
"a10|b10",
"a11",
"a12",
"a13",
"a14",
"a15");
249 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5|b5",
"a6",
"a7",
"a8",
"a9",
"a10|b10",
"a11",
"a12",
"a13",
"a14",
"a15");
276 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5|b5",
"a6",
"a7",
"a8",
"a9",
"a10|b10",
"a11",
"a12",
"a13",
"a14",
"a15");
304 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5|b5",
"a6",
"a7",
"a8",
"a9",
"a10|b10",
"a11",
"a12",
"a13",
"a14",
"a15");
330 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5|b5",
"a6",
"a7",
"a8",
"a9",
"a10|b10",
"a11",
"a12",
"a13",
"a14",
"a15");
348 }
catch (
final IllegalArgumentException ignored) {
354 }
catch (
final IllegalArgumentException ignored) {
369 autojoinListsHelper.
newAutojoinLists(
"a0",
"a1",
"a2",
"a3",
"a4",
"a5|b5",
"a6",
"a7",
"a8",
"a9",
"a10|b10",
"a11",
"a12",
"a13",
"a14",
"a15");
378 for (
int y = 0; y < 3; y++) {
379 for (
int x = 0; x < 3; x++) {
396 }
catch (
final IllegalArgumentException ignored) {
403 }
catch (
final IllegalArgumentException ignored) {
MapModel< TestGameObject, TestMapArchObject, TestArchetype > newMapModel(final int w, final int h)
Creates a new MapModel instance.
A MapModel reflects the data of a map.
void testInsertDuplicate1()
Checks that inserting duplicate archetypes with autojoin works as expected.
Regression tests for AutojoinLists.
Helper class for regression tests to create MapModel instances.
void testRemove1()
Checks that removing with autojoin works as expected.
void testRemoveAlt2()
Checks that removing alternative archetypes with autojoin works as expected.
Implements AutojoinList related functions.
Helper class for creating MapModel instances for regression tests.
void newAutojoinListsFail(@NotNull final String expectedException, @NotNull final String... archetypeNames)
Creates a new AutojoinLists instance and expects an error.
void removeGameObject(@NotNull G gameObject, boolean join)
Delete an existing GameObject from the map.
void testInsertAlt2()
Checks that inserting alternative archetypes with autojoin works as expected.
A MapArchObject implementation for testing purposes.
void testRemoveAlt3()
Checks that removing alternative archetypes with autojoin works as expected.
Base package of all Gridarta classes.
TestGameObject insertArchetype(@NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype > mapModel, final int x, final int y, @NotNull final BaseObject< TestGameObject, TestMapArchObject, TestArchetype, ?> archetype, final boolean join)
Inserts an archetype game object into a map model.
void testRemoveAlt1()
Checks that removing alternative archetypes with autojoin works as expected.
An Exception indicating that an Archetype name is not unique.
GameObjects are the objects based on Archetypes found on maps.
Exception thrown if an AutojoinList is invalid.
static void checkMapContents(@NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype > mapModel, @NotNull final String... lines)
Checks for expected MapModel's contents.
void testInsertReplace1()
Checks that replacing archetypes works as expected.
TestArchetype getArchetype(@NotNull final String archetypeName)
Returns an archetype.
TestMapModelHelper newTestMapModelHelper()
Creates a new TestMapModelHelper instance.
void newAutojoinLists(@NotNull final String... archetypeNames)
Creates a new AutojoinLists instance.
void testInsert1()
Checks that inserting with autojoin works as expected.
An Archetype implementation for testing purposes.
void testWrongCount()
Checks that a wrong number of archetypes is detected.
A GameObject implementation for testing purposes.
void testInsertAlt3()
Checks that inserting alternative archetypes with autojoin works as expected.
void beginTransaction(@NotNull String name)
Starts a new transaction.
void testInsertAlt1()
Checks that inserting alternative archetypes with autojoin works as expected.
void testDuplicateArchetype1()
Checks that duplicate archetypes are detected.
void testDuplicateArchetype2()
Checks that duplicate archetypes are detected.