api unit testing
This commit is contained in:
parent
1ee428cf69
commit
dcd19e5999
6 changed files with 96 additions and 10 deletions
|
@ -0,0 +1,90 @@
|
|||
package org.dimdev.dimdoors.api;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.Bootstrap;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||
import org.dimdev.dimdoors.block.door.data.condition.Condition;
|
||||
import org.dimdev.dimdoors.pockets.generator.PocketGenerator;
|
||||
import org.dimdev.dimdoors.pockets.modifier.Modifier;
|
||||
import org.dimdev.dimdoors.pockets.virtual.AbstractVirtualPocket;
|
||||
import org.dimdev.dimdoors.rift.targets.VirtualTarget;
|
||||
import org.dimdev.dimdoors.world.pocket.type.AbstractPocket;
|
||||
import org.dimdev.dimdoors.world.pocket.type.addon.PocketAddon;
|
||||
import org.dimdev.test.ServerTestRunner;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@RunWith(ServerTestRunner.class)
|
||||
public class DimensionalDoorsApiTest implements DimensionalDoorsApi {
|
||||
private static boolean hasCalledRegisterVirtualTargetTypes = false;
|
||||
private static boolean hasCalledRegisterVirtualSingularPocketTypes = false;
|
||||
private static boolean hasCalledRegisterModifierTypes = false;
|
||||
private static boolean hasCalledRegisterPocketGeneratorTypes = false;
|
||||
private static boolean hasCalledRegisterAbstractPocketTypes = false;
|
||||
private static boolean hasCalledRegisterPocketAddonTypes = false;
|
||||
private static boolean hasCalledRegisterConditionTypes = false;
|
||||
private static boolean hasCalledPostInitialize = false;
|
||||
|
||||
@Test
|
||||
public void apiTest() {
|
||||
Bootstrap.initialize();
|
||||
FabricLoader.getInstance().getEntrypoints("main", ModInitializer.class).stream()
|
||||
.filter(DimensionalDoorsInitializer.class::isInstance)
|
||||
.map(DimensionalDoorsInitializer.class::cast)
|
||||
.forEach(DimensionalDoorsInitializer::onInitialize);
|
||||
|
||||
assertTrue(hasCalledRegisterVirtualTargetTypes);
|
||||
assertTrue(hasCalledRegisterVirtualSingularPocketTypes);
|
||||
assertTrue(hasCalledRegisterModifierTypes);
|
||||
assertTrue(hasCalledRegisterPocketGeneratorTypes);
|
||||
assertTrue(hasCalledRegisterAbstractPocketTypes);
|
||||
assertTrue(hasCalledRegisterPocketAddonTypes);
|
||||
assertTrue(hasCalledRegisterConditionTypes);
|
||||
assertTrue(hasCalledPostInitialize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerVirtualTargetTypes(Registry<VirtualTarget.VirtualTargetType<?>> registry) {
|
||||
System.out.println("test1234");
|
||||
hasCalledRegisterVirtualTargetTypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerVirtualSingularPocketTypes(Registry<AbstractVirtualPocket.VirtualPocketType<?>> registry) {
|
||||
hasCalledRegisterVirtualSingularPocketTypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerModifierTypes(Registry<Modifier.ModifierType<?>> registry) {
|
||||
hasCalledRegisterModifierTypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPocketGeneratorTypes(Registry<PocketGenerator.PocketGeneratorType<?>> registry) {
|
||||
hasCalledRegisterPocketGeneratorTypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAbstractPocketTypes(Registry<AbstractPocket.AbstractPocketType<?>> registry) {
|
||||
hasCalledRegisterAbstractPocketTypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPocketAddonTypes(Registry<PocketAddon.PocketAddonType<?>> registry) {
|
||||
hasCalledRegisterPocketAddonTypes = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerConditionTypes(Registry<Condition.ConditionType<?>> registry) {
|
||||
hasCalledRegisterConditionTypes= true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInitialize() {
|
||||
hasCalledPostInitialize = true;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package org.dimdev.dimdoors.util.math;
|
||||
package org.dimdev.dimdoors.api.util.math;
|
||||
|
||||
import org.dimdev.dimdoors.api.util.math.Equation;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
|
@ -1,6 +1,5 @@
|
|||
package org.dimdev.dimdoors.util.math;
|
||||
package org.dimdev.dimdoors.api.util.math;
|
||||
|
||||
import org.dimdev.dimdoors.api.util.math.GridUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
|
@ -1,10 +1,9 @@
|
|||
package org.dimdev.dimdoors.util.math;
|
||||
package org.dimdev.dimdoors.api.util.math;
|
||||
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.EulerAngle;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import org.dimdev.dimdoors.api.util.math.MathUtil;
|
||||
import org.dimdev.test.TestUtil;
|
||||
import org.junit.Test;
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
package org.dimdev.dimdoors.util.math;
|
||||
package org.dimdev.dimdoors.api.util.math;
|
||||
|
||||
import net.minecraft.util.math.EulerAngle;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
import org.dimdev.dimdoors.api.util.math.TransformationMatrix3d;
|
||||
import org.dimdev.test.TestUtil;
|
||||
import org.junit.Test;
|
||||
|
|
@ -9,10 +9,10 @@ import org.junit.runner.RunWith;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@RunWith(ServerTestRunner.class)
|
||||
//@RunWith(ServerTestRunner.class)
|
||||
public class PocketDirectoryTest {
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void newPocket() {
|
||||
PocketDirectory directory = new PocketDirectory(ModDimensions.DUNGEON, 13);//
|
||||
|
||||
|
|
Loading…
Reference in a new issue