use of win.baruna.blockmeter.BlockMeterClient in project BlockMeter by ModProg.
the class ClientMeasureBoxTest method testSetColorIndex.
@ParameterizedTest
@JSONSource(classes = { ParseDyeColor.class }, jsons = { "red", "blue", "white", "black" })
void testSetColorIndex(DyeColor color) {
try (MockedStatic<BlockMeterClient> client = getBMC()) {
ClientMeasureBox.setColorIndex(color.getId());
final ClientMeasureBox box = ClientMeasureBox.getBox(new BlockPos(0, 0, 0), OVERWORLD_ID);
assertThat(box.getColor()).isEqualTo(color);
}
}
use of win.baruna.blockmeter.BlockMeterClient in project BlockMeter by ModProg.
the class ClientMeasureBoxTest method getBMC.
@SuppressWarnings("unchecked")
private MockedStatic<BlockMeterClient> getBMC() {
final MockedStatic<BlockMeterClient> client = Mockito.mockStatic(BlockMeterClient.class);
final ConfigManager<ModConfig> configHolder = Mockito.mock(ConfigManager.class);
when(configHolder.getConfig()).thenReturn(new ModConfig());
client.when(BlockMeterClient::getConfigManager).thenReturn(configHolder);
return client;
}
use of win.baruna.blockmeter.BlockMeterClient in project BlockMeter by ModProg.
the class ClientMeasureBoxTest method testGetMeasureBox.
@ParameterizedTest
@JSONSource(classes = { ParseBlockPos.class, ParseIdentifier.class, ParseDyeColor.class, Boolean.class }, jsons = { "(1|2|3), overworld, blue, true", "(-10|200|3123), nether, black, false", "(-112312|100|33), end, red, true" })
void testGetMeasureBox(final BlockPos bp, final Identifier id, final DyeColor color, final boolean incrementColor) {
try (MockedStatic<BlockMeterClient> client = getBMC()) {
final ModConfig config = BlockMeterClient.getConfigManager().getConfig();
config.colorIndex = color.getId();
config.incrementColor = incrementColor;
final ClientMeasureBox box = ClientMeasureBox.getBox(bp, id);
assertThat(box.getBlockStart()).isEqualTo(bp);
assertThat(box.getBlockEnd()).isEqualTo(bp);
assertThat(box.getDimension()).isEqualTo(id);
assertThat(box.isFinished()).isFalse();
assertThat(box.getColor()).isEqualTo(color);
if (!incrementColor)
assertThat(DyeColor.byId(config.colorIndex)).isEqualTo(color);
else
assertThat(DyeColor.byId(config.colorIndex)).isNotEqualTo(color);
}
}
Aggregations