20 package net.sf.gridarta.model.mapmodel;
22 import java.awt.Point;
23 import java.util.Iterator;
31 import org.jetbrains.annotations.NotNull;
32 import org.junit.Assert;
33 import org.junit.Before;
34 import org.junit.Test;
113 mapModelCreator.
addGameObjectToMap(mapModel,
"floor",
"1", 0, 0, topmostInsertionMode);
114 mapModelCreator.
addGameObjectToMap(mapModel,
"wall",
"2", 0, 0, topmostInsertionMode);
121 final Iterator<TestGameObject> it = mapSquare.
iterator();
122 Assert.assertTrue(it.hasNext());
123 Assert.assertEquals(
"1", it.next().getBestName());
124 Assert.assertTrue(it.hasNext());
125 Assert.assertEquals(
"4", it.next().getBestName());
126 Assert.assertTrue(it.hasNext());
127 Assert.assertEquals(
"3", it.next().getBestName());
128 Assert.assertFalse(it.hasNext());
139 mapModelCreator.
addGameObjectToMap(mapModel,
"floor",
"1", 0, 0, topmostInsertionMode);
146 final Iterator<TestGameObject> it = mapSquare.
iterator();
147 Assert.assertTrue(it.hasNext());
148 Assert.assertEquals(
"1", it.next().getBestName());
149 Assert.assertTrue(it.hasNext());
150 Assert.assertEquals(
"4", it.next().getBestName());
151 Assert.assertTrue(it.hasNext());
152 Assert.assertEquals(
"3", it.next().getBestName());
153 Assert.assertFalse(it.hasNext());
Regression tests for AutoInsertionMode.
final InsertionMode< TestGameObject, TestMapArchObject, TestArchetype > topmostInsertionMode
The topmost-insertion mode.
MapModel< TestGameObject, TestMapArchObject, TestArchetype > newMapModel(final int w, final int h)
Creates a new MapModel instance.
A MapModel reflects the data of a map.
Interface for classes that match GameObjects.
This package contains classes related to matching GameObjects, so called GameObjectMatchers.
ArchetypeSet< TestGameObject, TestMapArchObject, TestArchetype > getArchetypeSet()
Returns the ArchetypeSet.
Helper class for regression tests to create MapModel instances.
void endTransaction()
End a transaction.
final GameObjectMatcher belowFloorGameObjectMatcher
A GameObjectMatcher that matches objects to be put below the floor.
void testInsertSystemObject2()
Checks that the auto-insertion mode works as expected.
final GameObjectMatcher systemGameObjectMatcher
A GameObjectMatcher that matches system objects.
A MapArchObject implementation for testing purposes.
String TYPE
The attribute name of the object's type.
Base package of all Gridarta classes.
static final int TYPE_SYSTEM
The archetype type for system objects.
TestMapModelCreator mapModelCreator
The TestMapModelCreator instance.
An Exception indicating that an Archetype name is not unique.
final GameObjectMatcher wallGameObjectMatcher
A GameObjectMatcher that matches wall objects.
MapSquare< G, A, R > getMapSquare(@NotNull Point pos)
Get the square at a specified location.
GameObjects are the objects based on Archetypes found on maps.
static final int TYPE_BELOW_FLOOR
The archetype type for objects to be put below the floor.
TestArchetype newArchetype(@NotNull final String archetypeName)
Creates a new TestArchetype instance but doesn't add it to the archetype set.
void setUp()
Initializes the tests.
static final int TYPE_WALL
The archetype type for wall objects.
Iterator< G > iterator()
The Iterator returned does not recurse, it only contains objects on the first level.
final InsertionMode< TestGameObject, TestMapArchObject, TestArchetype > autoInsertionMode
The auto-insertion mode.
void addGameObjectToMap(@NotNull final MapModel< TestGameObject, TestMapArchObject, TestArchetype > mapModel, @NotNull final String archetypeName, @NotNull final String name, final int x, final int y, @NotNull final InsertionMode< TestGameObject, TestMapArchObject, TestArchetype > insertionMode)
Inserts a game object into a map.
An Archetype implementation for testing purposes.
An GameObjectMatcher matching certain archetype types.
A GameObject implementation for testing purposes.
Automatically guess the insertion position.
void beginTransaction(@NotNull String name)
Starts a new transaction.
static final int TYPE_FLOOR
The archetype type for floor objects.
void testInsertSystemObject1()
Checks that the auto-insertion mode works as expected.
final GameObjectMatcher floorGameObjectMatcher
A GameObjectMatcher that matches floor objects.