use of com.minecolonies.api.colony.requestsystem.token.StandardToken in project minecolonies by Minecolonies.
the class StandardFactoryControllerTest method testGetNewInstance.
@Test
public void testGetNewInstance() {
final UUID id = UUID.randomUUID();
final IToken token = new StandardToken(id);
final IToken output = StandardFactoryController.getInstance().getNewInstance(TypeConstants.ITOKEN, id);
assertEquals(output, token);
}
use of com.minecolonies.api.colony.requestsystem.token.StandardToken in project minecolonies by Minecolonies.
the class StandardFactoryControllerTest method testDeserialize.
@Test
public void testDeserialize() {
final StandardToken standardToken = new StandardToken(UUID.randomUUID());
final IToken token = standardToken;
final NBTTagCompound compound = StandardFactoryController.getInstance().serialize(token);
final IToken deserialize = StandardFactoryController.getInstance().deserialize(compound);
assertEquals(token, deserialize);
}
use of com.minecolonies.api.colony.requestsystem.token.StandardToken in project minecolonies by Minecolonies.
the class StandardFactoryControllerTest method testSerialize.
@Test
public void testSerialize() {
final StandardToken standardToken = new StandardToken(UUID.randomUUID());
final IToken token = standardToken;
final NBTTagCompound compound = StandardFactoryController.getInstance().serialize(token);
assertTrue(compound.hasKey(StandardFactoryController.NBT_TYPE));
assertTrue(compound.hasKey(StandardFactoryController.NBT_DATA));
assertEquals(compound.getString(StandardFactoryController.NBT_TYPE), new TypeToken<StandardToken>() {
}.toString());
assertEquals(compound.getCompoundTag(StandardFactoryController.NBT_DATA).getLong(StandardTokenFactory.NBT_MSB), standardToken.getIdentifier().getMostSignificantBits());
assertEquals(compound.getCompoundTag(StandardFactoryController.NBT_DATA).getLong(StandardTokenFactory.NBT_LSB), standardToken.getIdentifier().getLeastSignificantBits());
}
Aggregations