Moved VoronoiNoise and its tests to vanilla package for improved organisation.
This commit is contained in:
1 parent
900f65b591
commit
05a4b9dbd9
4 files changed
+17
-5
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package dev.overlord.zomboidforge.compat.b42.hooks;
|
package dev.overlord.zomboidforge.compat.b42.hooks;
|
||||||
|
|
||||||
import dev.overlord.zomboidforge.compat.b42.util.VoronoiNoise;
|
import dev.overlord.zomboidforge.compat.b42.vanilla.VoronoiNoise;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package dev.overlord.zomboidforge.compat.b42.util;
|
package dev.overlord.zomboidforge.compat.b42.vanilla;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* Equivalent implementations of vanilla game methods that hooks call instead of the original
|
||||||
|
* code. Unlike {@code util}, these classes use game classes; their tests compare them with the
|
||||||
|
* vanilla methods of the game jar.
|
||||||
|
*
|
||||||
|
* @noinspection UnstableApiUsage, RedundantSuppression
|
||||||
|
*/
|
||||||
|
@NotNullByDefault
|
||||||
|
package dev.overlord.zomboidforge.compat.b42.vanilla;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNullByDefault;
|
||||||
+4
-3
@@ -1,4 +1,4 @@
|
|||||||
package dev.overlord.zomboidforge.compat.b42.util;
|
package dev.overlord.zomboidforge.compat.b42.vanilla;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@@ -108,10 +108,11 @@ class VoronoiNoiseTest
|
|||||||
ZombieVoronoi voronoi = new ZombieVoronoi(1L, 0, type, 1.0, 0.0);
|
ZombieVoronoi voronoi = new ZombieVoronoi(1L, 0, type, 1.0, 0.0);
|
||||||
|
|
||||||
InvocationTargetException vanilla = assertThrows(InvocationTargetException.class, () -> VoronoiNoiseTest.vanilla(voronoi, 1.0, 1.0, new ArrayList<>()));
|
InvocationTargetException vanilla = assertThrows(InvocationTargetException.class, () -> VoronoiNoiseTest.vanilla(voronoi, 1.0, 1.0, new ArrayList<>()));
|
||||||
IndexOutOfBoundsException noise = assertThrows(IndexOutOfBoundsException.class, () -> VoronoiNoise.evaluate(type, 1L, 0, 1.0, 1.0, new Random(), new ArrayList<>()));
|
assertThrows(IndexOutOfBoundsException.class, () -> VoronoiNoise.evaluate(type, 1L, 0, 1.0, 1.0, new Random(), new ArrayList<>()));
|
||||||
|
|
||||||
|
// Only the type: once compiled, the JVM may throw a preallocated exception without a
|
||||||
|
// message (OmitStackTraceInFastThrow, on by default in tests).
|
||||||
assertInstanceOf(IndexOutOfBoundsException.class, vanilla.getCause());
|
assertInstanceOf(IndexOutOfBoundsException.class, vanilla.getCause());
|
||||||
assertEquals(vanilla.getCause().getMessage(), noise.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user