Update buildscripts (#354)

This commit is contained in:
Serenibyss
2024-01-09 00:47:53 -06:00
committed by GitHub
parent f7651fff29
commit 8c7185f8ff
20 changed files with 796 additions and 638 deletions
@@ -19,9 +19,10 @@
package appeng.core.worlddata;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
/**
* Tests for {@link MeteorDataNameEncoder}
@@ -51,7 +52,7 @@ public class MeteorDataNameEncoderTest
final String expected = WITHOUT_EXPECTED;
final String actual = this.encoderWithZeroShifting.encode( WITHOUT_DIMENSION, WITHOUT_CHUNK_X, WITHOUT_CHUNK_Z );
Assert.assertEquals( expected, actual );
assertThat( expected, is(actual) );
}
@Test
@@ -60,6 +61,6 @@ public class MeteorDataNameEncoderTest
final String expected = WITH_EXPECTED;
final String actual = this.encoderWithFourShifting.encode( WITH_DIMENSION, WITH_CHUNK_X, WITH_CHUNK_Z );
Assert.assertEquals( expected, actual );
assertThat( expected, is(actual) );
}
}
@@ -2,10 +2,11 @@
package appeng.core.worlddata;
import org.junit.Assert;
import org.junit.Test;
import net.minecraft.util.math.BlockPos;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
public class SpatialDimensionManagerTest
@@ -45,31 +46,31 @@ public class SpatialDimensionManagerTest
{
SpatialDimensionManager manager = new SpatialDimensionManager( null );
Assert.assertEquals( ID_1, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_2, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_3, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_4, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_5, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_6, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_7, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_8, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_9, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_A, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_B, manager.createNewCellDimension( CONTENT, -1 ) );
Assert.assertEquals( ID_C, manager.createNewCellDimension( CONTENT, -1 ) );
assertThat( ID_1, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
assertThat( ID_2, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
assertThat( ID_3, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
assertThat( ID_4, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
assertThat( ID_5, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
assertThat( ID_6, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
assertThat( ID_7, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
assertThat( ID_8, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
assertThat( ID_9, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
assertThat( ID_A, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
assertThat( ID_B, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
assertThat( ID_C, is(manager.createNewCellDimension( CONTENT, -1 ) ) );
Assert.assertEquals( POS_1, manager.getCellDimensionOrigin( ID_1 ) );
Assert.assertEquals( POS_2, manager.getCellDimensionOrigin( ID_2 ) );
Assert.assertEquals( POS_3, manager.getCellDimensionOrigin( ID_3 ) );
Assert.assertEquals( POS_4, manager.getCellDimensionOrigin( ID_4 ) );
Assert.assertEquals( POS_5, manager.getCellDimensionOrigin( ID_5 ) );
Assert.assertEquals( POS_6, manager.getCellDimensionOrigin( ID_6 ) );
Assert.assertEquals( POS_7, manager.getCellDimensionOrigin( ID_7 ) );
Assert.assertEquals( POS_8, manager.getCellDimensionOrigin( ID_8 ) );
Assert.assertEquals( POS_9, manager.getCellDimensionOrigin( ID_9 ) );
Assert.assertEquals( POS_A, manager.getCellDimensionOrigin( ID_A ) );
Assert.assertEquals( POS_B, manager.getCellDimensionOrigin( ID_B ) );
Assert.assertEquals( POS_C, manager.getCellDimensionOrigin( ID_C ) );
assertThat( POS_1, is(manager.getCellDimensionOrigin( ID_1 ) ) );
assertThat( POS_2, is(manager.getCellDimensionOrigin( ID_2 ) ) );
assertThat( POS_3, is(manager.getCellDimensionOrigin( ID_3 ) ) );
assertThat( POS_4, is(manager.getCellDimensionOrigin( ID_4 ) ) );
assertThat( POS_5, is(manager.getCellDimensionOrigin( ID_5 ) ) );
assertThat( POS_6, is(manager.getCellDimensionOrigin( ID_6 ) ) );
assertThat( POS_7, is(manager.getCellDimensionOrigin( ID_7 ) ) );
assertThat( POS_8, is(manager.getCellDimensionOrigin( ID_8 ) ) );
assertThat( POS_9, is(manager.getCellDimensionOrigin( ID_9 ) ) );
assertThat( POS_A, is(manager.getCellDimensionOrigin( ID_A ) ) );
assertThat( POS_B, is(manager.getCellDimensionOrigin( ID_B ) ) );
assertThat( POS_C, is(manager.getCellDimensionOrigin( ID_C ) ) );
}
}
@@ -19,9 +19,10 @@
package appeng.services.version;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
/**
* @author thatsIch
@@ -46,20 +47,20 @@ public class ModVersionFetcherTest
}
@Test
public void testInDev() throws Exception
public void testInDev()
{
Assert.assertEquals( this.indev.get(), new DoNotCheckVersion() );
assertThat( this.indev.get(), is( new DoNotCheckVersion() ) );
}
@Test
public void testPR() throws Exception
public void testPR()
{
Assert.assertEquals( this.pullRequest.get(), new DoNotCheckVersion() );
assertThat( this.pullRequest.get(), is( new DoNotCheckVersion() ) );
}
@Test
public void testWorking() throws Exception
public void testWorking()
{
Assert.assertEquals( this.working.get(), new DefaultVersion( 2, Channel.Beta, 8 ) );
assertThat( this.working.get(), is( new DefaultVersion( 2, Channel.Beta, 8) ) );
}
}
@@ -19,18 +19,17 @@
package appeng.services.version;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import appeng.services.version.exceptions.InvalidBuildException;
import appeng.services.version.exceptions.InvalidChannelException;
import appeng.services.version.exceptions.InvalidRevisionException;
import appeng.services.version.exceptions.InvalidVersionException;
import appeng.services.version.exceptions.MissingSeparatorException;
import appeng.services.version.exceptions.VersionCheckerException;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
@@ -63,66 +62,66 @@ public final class VersionParserTest
{
final Version version = this.parser.parse( GITHUB_VERSION );
assertEquals( version, version );
assertThat( version, is( version ) );
}
@Test
public void testParseGitHub() throws VersionCheckerException
{
assertTrue( this.parser.parse( GITHUB_VERSION ).equals( VERSION ) );
assertThat( this.parser.parse( GITHUB_VERSION ), is( VERSION ) );
}
@Test( expected = InvalidRevisionException.class )
public void parseGH_InvalidRevision() throws VersionCheckerException
@Test
public void parseGH_InvalidRevision()
{
assertFalse( this.parser.parse( GITHUB_INVALID_REVISION ).equals( VERSION ) );
assertThrows( InvalidRevisionException.class, () -> this.parser.parse( GITHUB_INVALID_REVISION ));
}
@Test( expected = InvalidChannelException.class )
public void parseGH_InvalidChannel() throws VersionCheckerException
@Test
public void parseGH_InvalidChannel()
{
assertFalse( this.parser.parse( GITHUB_INVALID_CHANNEL ).equals( VERSION ) );
assertThrows( InvalidChannelException.class, () -> this.parser.parse( GITHUB_INVALID_CHANNEL ) );
}
@Test( expected = InvalidBuildException.class )
public void parseGH_InvalidBuild() throws VersionCheckerException
@Test
public void parseGH_InvalidBuild()
{
assertFalse( this.parser.parse( GITHUB_INVALID_BUILD ).equals( VERSION ) );
assertThrows( InvalidBuildException.class, () -> this.parser.parse( GITHUB_INVALID_BUILD ) );
}
@Test
public void testParseMod() throws VersionCheckerException
{
assertTrue( this.parser.parse( MOD_VERSION ).equals( VERSION ) );
assertThat( this.parser.parse( MOD_VERSION ), is( VERSION ) );
}
@Test( expected = InvalidRevisionException.class )
public void parseMod_InvalidRevision() throws VersionCheckerException
@Test
public void parseMod_InvalidRevision()
{
assertFalse( this.parser.parse( MOD_INVALID_REVISION ).equals( VERSION ) );
assertThrows( InvalidRevisionException.class, () -> this.parser.parse( MOD_INVALID_REVISION ) );
}
@Test( expected = InvalidChannelException.class )
public void parseMod_InvalidChannel() throws VersionCheckerException
@Test
public void parseMod_InvalidChannel()
{
assertFalse( this.parser.parse( MOD_INVALID_CHANNEL ).equals( VERSION ) );
assertThrows( InvalidChannelException.class, () -> this.parser.parse( MOD_INVALID_CHANNEL ) );
}
@Test( expected = InvalidBuildException.class )
public void parseMod_InvalidBuild() throws VersionCheckerException
@Test
public void parseMod_InvalidBuild()
{
assertFalse( this.parser.parse( MOD_INVALID_BUILD ).equals( VERSION ) );
assertThrows( InvalidBuildException.class, () -> this.parser.parse( MOD_INVALID_BUILD ) );
}
@Test( expected = MissingSeparatorException.class )
public void parseGeneric_MissingSeparator() throws VersionCheckerException
@Test
public void parseGeneric_MissingSeparator()
{
assertFalse( this.parser.parse( GENERIC_MISSING_SEPARATOR ).equals( VERSION ) );
assertThrows( MissingSeparatorException.class, () -> this.parser.parse( GENERIC_MISSING_SEPARATOR ) );
}
@Test( expected = InvalidVersionException.class )
public void parseGeneric_InvalidVersion() throws VersionCheckerException
@Test
public void parseGeneric_InvalidVersion()
{
assertFalse( this.parser.parse( GENERIC_INVALID_VERSION ).equals( VERSION ) );
assertThrows( InvalidVersionException.class, () -> this.parser.parse( GENERIC_INVALID_VERSION ) );
}
}
@@ -19,8 +19,10 @@
package appeng.services.version;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
/**
@@ -43,77 +45,77 @@ public final class VersionTest
@Test
public void testDevBuild()
{
Assert.assertEquals( DO_NOT_CHECK_VERSION.formatted(), "dev build" );
assertThat( DO_NOT_CHECK_VERSION.formatted(), is( "dev build" ) );
}
@Test
public void testMissingBuild()
{
Assert.assertEquals( MISSING_VERSION.formatted(), "missing" );
assertThat( MISSING_VERSION.formatted(), is ( "missing" ) );
}
@Test
public void compareVersionToDoNotCheck()
{
Assert.assertFalse( DEFAULT_VERSION_RV2_ALPHA_8.isNewerAs( DO_NOT_CHECK_VERSION ) );
Assert.assertTrue( DO_NOT_CHECK_VERSION.isNewerAs( DEFAULT_VERSION_RV2_ALPHA_8 ) );
assertThat( DEFAULT_VERSION_RV2_ALPHA_8.isNewerAs( DO_NOT_CHECK_VERSION ), is( false ) );
assertThat( DO_NOT_CHECK_VERSION.isNewerAs( DEFAULT_VERSION_RV2_ALPHA_8 ), is( true ) );
}
@Test
public void compareVersionToMissingVersion()
{
Assert.assertTrue( DEFAULT_VERSION_RV2_ALPHA_8.isNewerAs( MISSING_VERSION ) );
Assert.assertFalse( MISSING_VERSION.isNewerAs( DEFAULT_VERSION_RV2_ALPHA_8 ) );
assertThat( DEFAULT_VERSION_RV2_ALPHA_8.isNewerAs( MISSING_VERSION ), is( true ) );
assertThat( MISSING_VERSION.isNewerAs( DEFAULT_VERSION_RV2_ALPHA_8 ), is( false ) );
}
@Test
public void compareTwoDefaultVersions()
{
Assert.assertTrue( DEFAULT_VERSION_RV2_BETA_8.isNewerAs( DEFAULT_VERSION_RV2_ALPHA_8 ) );
Assert.assertTrue( DEFAULT_VERSION_RV4_ALPHA_1.isNewerAs( DEFAULT_VERSION_RV3_BETA_8 ) );
Assert.assertTrue( DEFAULT_VERSION_RV2_BETA_9.isNewerAs( DEFAULT_VERSION_RV2_BETA_8 ) );
assertThat( DEFAULT_VERSION_RV2_BETA_8.isNewerAs( DEFAULT_VERSION_RV2_ALPHA_8 ), is( true ) );
assertThat( DEFAULT_VERSION_RV4_ALPHA_1.isNewerAs( DEFAULT_VERSION_RV3_BETA_8 ), is( true ) );
assertThat( DEFAULT_VERSION_RV2_BETA_9.isNewerAs( DEFAULT_VERSION_RV2_BETA_8 ), is( true ) );
}
@Test
public void testEqualsNonVersion()
{
Assert.assertFalse( DEFAULT_VERSION_RV2_ALPHA_8.equals( new Object() ) );
assertThat( DEFAULT_VERSION_RV2_ALPHA_8, is( not( equalTo( new Object() ) ) ) );
}
@Test
public void testEqualsUnequalBuild()
{
Assert.assertFalse( DEFAULT_VERSION_RV2_BETA_8.equals( DEFAULT_VERSION_RV2_BETA_9 ) );
assertThat( DEFAULT_VERSION_RV2_BETA_8, is( not( equalTo( DEFAULT_VERSION_RV2_BETA_9 ) ) ) );
}
@Test
public void testEqualsUnequalChannel()
{
Assert.assertFalse( DEFAULT_VERSION_RV2_BETA_8.equals( DEFAULT_VERSION_RV2_ALPHA_8 ) );
assertThat( DEFAULT_VERSION_RV2_BETA_8, is( not( equalTo( DEFAULT_VERSION_RV2_ALPHA_8 ) ) ) );
}
@Test
public void testEqualsUnequalRevision()
{
Assert.assertFalse( DEFAULT_VERSION_RV2_BETA_8.equals( DEFAULT_VERSION_RV3_BETA_8 ) );
assertThat( DEFAULT_VERSION_RV2_BETA_8, is( not( equalTo( DEFAULT_VERSION_RV3_BETA_8 ) ) ) );
}
@Test
public void testUnequalHash()
{
Assert.assertNotEquals( DEFAULT_VERSION_RV2_BETA_8.hashCode(), DEFAULT_VERSION_RV2_ALPHA_8.hashCode() );
assertThat( DEFAULT_VERSION_RV2_BETA_8.hashCode(), is( not( equalTo( DEFAULT_VERSION_RV2_ALPHA_8.hashCode() ) ) ) );
}
@Test
public void testToString()
{
Assert.assertEquals( DEFAULT_VERSION_RV2_BETA_8.toString(), "Version{revision=2, channel=Beta, build=8}" );
assertThat( DEFAULT_VERSION_RV2_BETA_8.toString(), is( "Version{revision=2, channel=Beta, build=8}" ) );
}
@Test
public void testFormatted()
{
Assert.assertEquals( DEFAULT_VERSION_RV2_BETA_8.formatted(), "rv2-beta-8" );
assertThat( DEFAULT_VERSION_RV2_BETA_8.formatted(), is( "rv2-beta-8" ) );
}
}
@@ -2,9 +2,11 @@
package appeng.util;
import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
/*
@@ -72,75 +74,75 @@ public final class SlimReadableNumberConverterTest
private final ISlimReadableNumberConverter converter = ReadableNumberConverter.INSTANCE;
@Test( expected = AssertionError.class )
@Test
public void testConvertNeg999999()
{
assertEquals( RESULT_NEG_999999, this.converter.toSlimReadableForm( NUMBER_NEG_999999 ) );
assertThrows(AssertionError.class, () -> this.converter.toSlimReadableForm( NUMBER_NEG_999999 ) );
}
@Test( expected = AssertionError.class )
@Test
public void testConvertNeg9999()
{
assertEquals( RESULT_NEG_9999, this.converter.toSlimReadableForm( NUMBER_NEG_9999 ) );
assertThrows(AssertionError.class, () -> this.converter.toSlimReadableForm( NUMBER_NEG_9999 ) );
}
@Test( expected = AssertionError.class )
@Test
public void testConvertNeg999()
{
assertEquals( RESULT_NEG_999, this.converter.toSlimReadableForm( NUMBER_NEG_999 ) );
assertThrows(AssertionError.class, () -> this.converter.toSlimReadableForm( NUMBER_NEG_999 ) );
}
@Test
public void testConvert0()
{
assertEquals( RESULT_0, this.converter.toSlimReadableForm( NUMBER_0 ) );
assertThat( RESULT_0, is( this.converter.toSlimReadableForm( NUMBER_0 ) ) );
}
@Test
public void testConvert999()
{
assertEquals( RESULT_999, this.converter.toSlimReadableForm( NUMBER_999 ) );
assertThat( RESULT_999, is( this.converter.toSlimReadableForm( NUMBER_999 ) ) );
}
@Test
public void testConvert9999()
{
assertEquals( RESULT_9999, this.converter.toSlimReadableForm( NUMBER_9999 ) );
assertThat( RESULT_9999, is( this.converter.toSlimReadableForm( NUMBER_9999 ) ) );
}
@Test
public void testConvert10000()
{
assertEquals( RESULT_10000, this.converter.toSlimReadableForm( NUMBER_10000 ) );
assertThat( RESULT_10000, is( this.converter.toSlimReadableForm( NUMBER_10000 ) ) );
}
@Test
public void testConvert10500()
{
assertEquals( RESULT_10500, this.converter.toSlimReadableForm( NUMBER_10500 ) );
assertThat( RESULT_10500, is( this.converter.toSlimReadableForm( NUMBER_10500 ) ) );
}
@Test
public void testConvert155555()
{
assertEquals( RESULT_155555, this.converter.toSlimReadableForm( NUMBER_155555 ) );
assertThat( RESULT_155555, is( this.converter.toSlimReadableForm( NUMBER_155555 ) ) );
}
@Test
public void testConvert9999999()
{
assertEquals( RESULT_9999999, this.converter.toSlimReadableForm( NUMBER_9999999 ) );
assertThat( RESULT_9999999, is( this.converter.toSlimReadableForm( NUMBER_9999999 ) ) );
}
@Test
public void testConvert10000000()
{
assertEquals( RESULT_10000000, this.converter.toSlimReadableForm( NUMBER_10000000 ) );
assertThat( RESULT_10000000, is( this.converter.toSlimReadableForm( NUMBER_10000000 ) ) );
}
@Test
public void testConvert155555555()
{
assertEquals( RESULT_155555555, this.converter.toSlimReadableForm( NUMBER_155555555 ) );
assertThat( RESULT_155555555, is( this.converter.toSlimReadableForm( NUMBER_155555555 ) ) );
}
}
@@ -19,10 +19,10 @@
package appeng.util;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
/**
@@ -44,18 +44,18 @@ public final class UUIDMatcherTest
@Test
public void testUUID_shouldPass()
{
assertTrue( this.matcher.isUUID( IS_UUID ) );
assertThat( this.matcher.isUUID( IS_UUID ), is( true ) );
}
@Test
public void testNoUUD_shouldPass()
{
assertFalse( this.matcher.isUUID( NO_UUID ) );
assertThat( this.matcher.isUUID( NO_UUID ), is( false ) );
}
@Test
public void testInvalidUUID_shouldPass()
{
assertFalse( this.matcher.isUUID( INVALID_UUID ) );
assertThat( this.matcher.isUUID( INVALID_UUID ), is( false ) );
}
}
@@ -19,9 +19,11 @@
package appeng.util;
import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
@@ -71,75 +73,75 @@ public final class WideReadableNumberConverterTest
private final IWideReadableNumberConverter converter = ReadableNumberConverter.INSTANCE;
@Test( expected = AssertionError.class )
@Test
public void testConvertNeg999999()
{
assertEquals( RESULT_NEG_999999, this.converter.toWideReadableForm( NUMBER_NEG_999999 ) );
assertThrows( AssertionError.class, () -> this.converter.toWideReadableForm( NUMBER_NEG_999999 ) );
}
@Test( expected = AssertionError.class )
@Test
public void testConvertNeg9999()
{
assertEquals( RESULT_NEG_9999, this.converter.toWideReadableForm( NUMBER_NEG_9999 ) );
assertThrows( AssertionError.class, () -> this.converter.toWideReadableForm( NUMBER_NEG_9999 ) );
}
@Test( expected = AssertionError.class )
@Test
public void testConvertNeg999()
{
assertEquals( RESULT_NEG_999, this.converter.toWideReadableForm( NUMBER_NEG_999 ) );
assertThrows( AssertionError.class, () -> this.converter.toWideReadableForm( NUMBER_NEG_999 ) );
}
@Test
public void testConvert0()
{
assertEquals( RESULT_0, this.converter.toWideReadableForm( NUMBER_0 ) );
assertThat( RESULT_0, is( this.converter.toWideReadableForm( NUMBER_0 ) ) );
}
@Test
public void testConvert999()
{
assertEquals( RESULT_999, this.converter.toWideReadableForm( NUMBER_999 ) );
assertThat( RESULT_999, is( this.converter.toWideReadableForm( NUMBER_999 ) ) );
}
@Test
public void testConvert9999()
{
assertEquals( RESULT_9999, this.converter.toWideReadableForm( NUMBER_9999 ) );
assertThat( RESULT_9999, is( this.converter.toWideReadableForm( NUMBER_9999 ) ) );
}
@Test
public void testConvert10000()
{
assertEquals( RESULT_10000, this.converter.toWideReadableForm( NUMBER_10000 ) );
assertThat( RESULT_10000, is( this.converter.toWideReadableForm( NUMBER_10000 ) ) );
}
@Test
public void testConvert10500()
{
assertEquals( RESULT_10500, this.converter.toWideReadableForm( NUMBER_10500 ) );
assertThat( RESULT_10500, is( this.converter.toWideReadableForm( NUMBER_10500 ) ) );
}
@Test
public void testConvert155555()
{
assertEquals( RESULT_155555, this.converter.toWideReadableForm( NUMBER_155555 ) );
assertThat( RESULT_155555, is( this.converter.toWideReadableForm( NUMBER_155555 ) ) );
}
@Test
public void testConvert9999999()
{
assertEquals( RESULT_9999999, this.converter.toWideReadableForm( NUMBER_9999999 ) );
assertThat( RESULT_9999999, is( this.converter.toWideReadableForm( NUMBER_9999999 ) ) );
}
@Test
public void testConvert10000000()
{
assertEquals( RESULT_10000000, this.converter.toWideReadableForm( NUMBER_10000000 ) );
assertThat( RESULT_10000000, is( this.converter.toWideReadableForm( NUMBER_10000000 ) ) );
}
@Test
public void testConvert155555555()
{
assertEquals( RESULT_155555555, this.converter.toWideReadableForm( NUMBER_155555555 ) );
assertThat( RESULT_155555555, is( this.converter.toWideReadableForm( NUMBER_155555555 ) ) );
}
}
@@ -18,13 +18,11 @@
package appeng.util.helpers;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import appeng.api.util.AEColor;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
public class P2PHelperTest
@@ -50,17 +48,17 @@ public class P2PHelperTest
@Test
public void testToColors()
{
assertArrayEquals( WHITE_COLORS, this.unitUnderTest.toColors( WHITE_FREQUENCY ) );
assertArrayEquals( BLACK_COLORS, this.unitUnderTest.toColors( BLACK_FREQUENCY ) );
assertArrayEquals( MULTI_COLORS, this.unitUnderTest.toColors( MULTI_FREQUENCY ) );
assertThat( WHITE_COLORS, is( this.unitUnderTest.toColors( WHITE_FREQUENCY ) ) );
assertThat( BLACK_COLORS, is( this.unitUnderTest.toColors( BLACK_FREQUENCY ) ) );
assertThat( MULTI_COLORS, is( this.unitUnderTest.toColors( MULTI_FREQUENCY ) ) );
}
@Test
public void testFromColors()
{
assertEquals( WHITE_FREQUENCY, this.unitUnderTest.fromColors( WHITE_COLORS ) );
assertEquals( BLACK_FREQUENCY, this.unitUnderTest.fromColors( BLACK_COLORS ) );
assertEquals( MULTI_FREQUENCY, this.unitUnderTest.fromColors( MULTI_COLORS ) );
assertThat( WHITE_FREQUENCY, is( this.unitUnderTest.fromColors( WHITE_COLORS ) ) );
assertThat( BLACK_FREQUENCY, is( this.unitUnderTest.fromColors( BLACK_COLORS ) ) );
assertThat( MULTI_FREQUENCY, is( this.unitUnderTest.fromColors( MULTI_COLORS ) ) );
}
@Test
@@ -68,40 +66,39 @@ public class P2PHelperTest
{
for( short i = Short.MIN_VALUE; i < Short.MAX_VALUE; i++ )
{
assertEquals( i, this.unitUnderTest.fromColors( this.unitUnderTest.toColors( i ) ) );
assertThat( i, is( this.unitUnderTest.fromColors( this.unitUnderTest.toColors( i ) ) ));
}
}
@Test
public void testToHexDigit()
{
assertEquals( "0", this.unitUnderTest.toHexDigit( AEColor.WHITE ) );
assertEquals( "1", this.unitUnderTest.toHexDigit( AEColor.ORANGE ) );
assertEquals( "2", this.unitUnderTest.toHexDigit( AEColor.MAGENTA ) );
assertEquals( "3", this.unitUnderTest.toHexDigit( AEColor.LIGHT_BLUE ) );
assertEquals( "4", this.unitUnderTest.toHexDigit( AEColor.YELLOW ) );
assertEquals( "5", this.unitUnderTest.toHexDigit( AEColor.LIME ) );
assertEquals( "6", this.unitUnderTest.toHexDigit( AEColor.PINK ) );
assertEquals( "7", this.unitUnderTest.toHexDigit( AEColor.GRAY ) );
assertEquals( "8", this.unitUnderTest.toHexDigit( AEColor.LIGHT_GRAY ) );
assertEquals( "9", this.unitUnderTest.toHexDigit( AEColor.CYAN ) );
assertEquals( "A", this.unitUnderTest.toHexDigit( AEColor.PURPLE ) );
assertEquals( "B", this.unitUnderTest.toHexDigit( AEColor.BLUE ) );
assertEquals( "C", this.unitUnderTest.toHexDigit( AEColor.BROWN ) );
assertEquals( "D", this.unitUnderTest.toHexDigit( AEColor.GREEN ) );
assertEquals( "E", this.unitUnderTest.toHexDigit( AEColor.RED ) );
assertEquals( "F", this.unitUnderTest.toHexDigit( AEColor.BLACK ) );
assertThat( "0", is( this.unitUnderTest.toHexDigit( AEColor.WHITE ) ) );
assertThat( "1", is( this.unitUnderTest.toHexDigit( AEColor.ORANGE ) ) );
assertThat( "2", is( this.unitUnderTest.toHexDigit( AEColor.MAGENTA ) ) );
assertThat( "3", is( this.unitUnderTest.toHexDigit( AEColor.LIGHT_BLUE ) ) );
assertThat( "4", is( this.unitUnderTest.toHexDigit( AEColor.YELLOW ) ) );
assertThat( "5", is( this.unitUnderTest.toHexDigit( AEColor.LIME ) ) );
assertThat( "6", is( this.unitUnderTest.toHexDigit( AEColor.PINK ) ) );
assertThat( "7", is( this.unitUnderTest.toHexDigit( AEColor.GRAY ) ) );
assertThat( "8", is( this.unitUnderTest.toHexDigit( AEColor.LIGHT_GRAY ) ) );
assertThat( "9", is( this.unitUnderTest.toHexDigit( AEColor.CYAN ) ) );
assertThat( "A", is( this.unitUnderTest.toHexDigit( AEColor.PURPLE ) ) );
assertThat( "B", is( this.unitUnderTest.toHexDigit( AEColor.BLUE ) ) );
assertThat( "C", is( this.unitUnderTest.toHexDigit( AEColor.BROWN ) ) );
assertThat( "D", is( this.unitUnderTest.toHexDigit( AEColor.GREEN ) ) );
assertThat( "E", is( this.unitUnderTest.toHexDigit( AEColor.RED ) ) );
assertThat( "F", is( this.unitUnderTest.toHexDigit( AEColor.BLACK ) ) );
}
@Test
public void testToHexString()
{
assertEquals( HEX_WHITE_FREQUENCY, this.unitUnderTest.toHexString( WHITE_FREQUENCY ) );
assertEquals( HEX_BLACK_FREQUENCY, this.unitUnderTest.toHexString( BLACK_FREQUENCY ) );
assertEquals( HEX_MULTI_FREQUENCY, this.unitUnderTest.toHexString( MULTI_FREQUENCY ) );
assertThat( HEX_WHITE_FREQUENCY, is( this.unitUnderTest.toHexString( WHITE_FREQUENCY ) ) );
assertThat( HEX_BLACK_FREQUENCY, is( this.unitUnderTest.toHexString( BLACK_FREQUENCY ) ) );
assertThat( HEX_MULTI_FREQUENCY, is( this.unitUnderTest.toHexString( MULTI_FREQUENCY ) ) );
assertEquals( HEX_MIN_FREQUENCY, this.unitUnderTest.toHexString( Short.MIN_VALUE ) );
assertEquals( HEX_MAX_FREQUENCY, this.unitUnderTest.toHexString( Short.MAX_VALUE ) );
assertThat( HEX_MIN_FREQUENCY, is( this.unitUnderTest.toHexString( Short.MIN_VALUE ) ) );
assertThat( HEX_MAX_FREQUENCY, is( this.unitUnderTest.toHexString( Short.MAX_VALUE ) ) );
}
}