20 package net.sf.gridarta.model.match;
36 import org.jetbrains.annotations.NotNull;
37 import org.jetbrains.annotations.Nullable;
38 import org.junit.Assert;
39 import org.junit.Test;
64 Assert.assertTrue(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1)));
65 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2)));
66 Assert.assertTrue(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1, 1)));
67 Assert.assertTrue(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2, 1)));
68 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1, 2)));
69 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2, 2)));
70 Assert.assertTrue(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1, 1, 1)));
71 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1, 2, 2)));
72 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2, 1, 2)));
73 Assert.assertTrue(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2, 2, 1)));
74 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2, 2, 2)));
89 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1)));
90 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2)));
91 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1, 1)));
92 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2, 1)));
93 Assert.assertTrue(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1, 2)));
94 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2, 2)));
95 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1, 1, 1)));
96 Assert.assertTrue(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1, 2, 2)));
97 Assert.assertTrue(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2, 1, 2)));
98 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2, 2, 1)));
99 Assert.assertFalse(namedGameObjectMatcher.
isMatching(
newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2, 2, 2)));
127 final TestGameObject gameObject = gameObjectFactory.createGameObject(archetype);
146 for (
final int typeNumber : typeNumbers) {
147 final String name = Integer.toString(typeNumber);
150 if (gameObject != null) {
151 tmp.addLast(gameObject);
155 if (gameObject == null) {
156 throw new IllegalArgumentException();
167 assert resourceIcons != null;
static TestGameObject newGameObject(@NotNull final GameObjectFactory< TestGameObject, TestMapArchObject, TestArchetype > gameObjectFactory, @NotNull final TestArchetype archetype, @NotNull final String gameObjectName)
Creates a new TestGameObject instance.
A FaceObjects for regression tests.
void testTypeNrsGameObjectMatcher2()
Checks that a NamedGameObjectMatcher works correctly when using an environment check.
Interface for classes that match GameObjects.
Gridarta can handle frame information of animations and allow the selection of an animation using a t...
An AnimationObjects for regression tests.
FaceObjectProviders newFaceObjectProviders()
Creates a new FaceObjectProviders instance.
Decorates an arbitrary GameObjectMatcher with a localized name that is suitable for the user interfac...
A MapArchObject implementation for testing purposes.
String TYPE
The attribute name of the object's type.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
An Archetype implementation for testing purposes.
Abstract factory for creating GameObject instances.
static TestArchetype newArchetype(@NotNull final String archetypeName, final int typeNo, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects)
Creates a new TestArchetype instance.
void testTypeNrsGameObjectMatcher1()
Checks that a NamedGameObjectMatcher works correctly when not using an environment check...
AnimationObjects is a container for AnimationObjects.
GameObjects are the objects based on Archetypes found on maps.
A GameObjectFactory for regression tests.
final ResourceIcons resourceIcons
The ResourceIcons instance.
FaceObjects is a container for FaceObjects.
Provider for faces of GameObjects and Archetypes.
The face is the appearance of an object.
Creates ImageIcon instances from resources.
String NAME
The attribute name of the object's name.
An Archetype implementation for testing purposes.
An GameObjectMatcher matching certain archetype types.
A GameObject implementation for testing purposes.
Regression tests for NamedGameObjectMatcher.
static GameObject<?, ?, ?> newGameObjects(@NotNull final GameObjectFactory< TestGameObject, TestMapArchObject, TestArchetype > gameObjectFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final int... typeNumbers)
Creates a chain of TestGameObject instances having the given type numbers.
boolean isMatching(@NotNull GameObject<?, ?, ?> gameObject)
Matches an GameObject.