mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-15 06:58:41 +00:00
Java 11 migrate c-d (remaining) (#1111)
* Moves converter pattern to Java 11 * Moves cqrs pattern to Java 11 * Moves dao pattern to Java 11 * Moves data-bus pattern to Java 11 * Moves data-locality pattern to Java 11 * Moves data-mapper pattern to Java 11 * Moves data-transfer-object pattern to Java 11 * Moves decorator pattern to Java 11 * Moves delegation pattern to Java 11 * Moves dependency-injection to Java 11 * Moves dirty-flag to Java 11 * Moves double-buffer to Java 11 * Moves double-checked-locking to Java 11 * Moves double-dispatch to Java 11 * Corrects with changes thats breaking test cases
This commit is contained in:
committed by
Ilkka Seppälä
parent
5681684157
commit
ea57934db6
@@ -23,13 +23,13 @@
|
||||
|
||||
package com.iluwatar.doubledispatch;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Date: 12/10/15 - 8:37 PM
|
||||
* Test for Collision
|
||||
* Date: 12/10/15 - 8:37 PM Test for Collision
|
||||
*
|
||||
* @param <O> Type of GameObject
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
@@ -51,15 +51,14 @@ public abstract class CollisionTest<O extends GameObject> {
|
||||
* @param otherOnFire Indicates if the other object should be burning after the collision
|
||||
* @param thisDamaged Indicates if the test object should be damaged after the collision
|
||||
* @param thisOnFire Indicates if the other object should be burning after the collision
|
||||
* @param description The expected description of the collision
|
||||
*/
|
||||
void testCollision(final GameObject other, final boolean otherDamaged, final boolean otherOnFire,
|
||||
final boolean thisDamaged, final boolean thisOnFire, final String description) {
|
||||
final boolean thisDamaged, final boolean thisOnFire) {
|
||||
|
||||
Objects.requireNonNull(other);
|
||||
Objects.requireNonNull(getTestedObject());
|
||||
|
||||
final O tested = getTestedObject();
|
||||
final var tested = getTestedObject();
|
||||
|
||||
tested.collision(other);
|
||||
|
||||
@@ -80,10 +79,10 @@ public abstract class CollisionTest<O extends GameObject> {
|
||||
* @param expectTargetOnFire The expected state of fire on the target object
|
||||
*/
|
||||
private void testOnFire(final GameObject target, final GameObject other, final boolean expectTargetOnFire) {
|
||||
final String targetName = target.getClass().getSimpleName();
|
||||
final String otherName = other.getClass().getSimpleName();
|
||||
final var targetName = target.getClass().getSimpleName();
|
||||
final var otherName = other.getClass().getSimpleName();
|
||||
|
||||
final String errorMessage = expectTargetOnFire
|
||||
final var errorMessage = expectTargetOnFire
|
||||
? "Expected [" + targetName + "] to be on fire after colliding with [" + otherName + "] but it was not!"
|
||||
: "Expected [" + targetName + "] not to be on fire after colliding with [" + otherName + "] but it was!";
|
||||
|
||||
@@ -99,10 +98,10 @@ public abstract class CollisionTest<O extends GameObject> {
|
||||
* @param expectedDamage The expected state of damage on the target object
|
||||
*/
|
||||
private void testDamaged(final GameObject target, final GameObject other, final boolean expectedDamage) {
|
||||
final String targetName = target.getClass().getSimpleName();
|
||||
final String otherName = other.getClass().getSimpleName();
|
||||
final var targetName = target.getClass().getSimpleName();
|
||||
final var otherName = other.getClass().getSimpleName();
|
||||
|
||||
final String errorMessage = expectedDamage
|
||||
final var errorMessage = expectedDamage
|
||||
? "Expected [" + targetName + "] to be damaged after colliding with [" + otherName + "] but it was not!"
|
||||
: "Expected [" + targetName + "] not to be damaged after colliding with [" + otherName + "] but it was!";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user