use of org.junit.jupiter.params.ParameterizedTest in project winery by eclipse.
the class YamlWriterTest method roundTripTest.
@DisplayName("Test read and write round trip")
@ParameterizedTest(name = "{index} name=''{0}''")
@MethodSource("getYamlFiles")
public void roundTripTest(Path fileName) throws Exception {
TServiceTemplate serviceTemplate = this.getYamlServiceTemplate(fileName);
writeYamlServiceTemplate(serviceTemplate, temporaryFolder.resolve(fileName));
TServiceTemplate out = this.getYamlServiceTemplate(fileName, temporaryFolder);
Assertions.assertEquals(serviceTemplate, out);
}
use of org.junit.jupiter.params.ParameterizedTest in project litiengine by gurkenlabs.
the class EnvironmentTests method testEntityByRenderType.
@ParameterizedTest
@EnumSource(value = RenderType.class)
public void testEntityByRenderType(RenderType renderType) {
ICombatEntity entity = mock(ICombatEntity.class);
when(entity.getMapId()).thenReturn(123);
when(entity.getName()).thenReturn("test");
when(entity.getRenderType()).thenReturn(renderType);
this.testEnvironment.add(entity);
assertNotNull(this.testEnvironment.get(123));
assertNotNull(this.testEnvironment.get("test"));
assertEquals(1, this.testEnvironment.getEntities(renderType).size());
this.testEnvironment.remove(entity);
assertNull(this.testEnvironment.get(123));
assertNull(this.testEnvironment.get("test"));
assertEquals(0, this.testEnvironment.getEntities(renderType).size());
}
use of org.junit.jupiter.params.ParameterizedTest in project Karus-Commons by Pante.
the class CommandTest method complete_subcommands.
@ParameterizedTest
@MethodSource("complete_parameters")
void complete_subcommands(String name, String permission, List<String> expected) {
Arguments arguments = new Arguments("subcommand");
Command subcommand = new Command(name, null);
subcommand.setPermission(permission);
command.getSubcommands().put(name, subcommand);
assertEquals(expected, command.complete(sender, arguments));
}
use of org.junit.jupiter.params.ParameterizedTest in project Karus-Commons by Pante.
the class ResettableComponentTest method reset.
@ParameterizedTest
@CsvSource({ "true, 1", "false, 0" })
void reset(boolean reset, int times) {
Window window = mock(Window.class);
InventoryCloseEvent event = mock(InventoryCloseEvent.class);
component.reset(reset);
component.reset(window, event);
assertEquals(reset, component.reset());
verify(component, times(times)).onReset(window, event);
}
use of org.junit.jupiter.params.ParameterizedTest in project Karus-Commons by Pante.
the class CheckBoxTest method click.
@ParameterizedTest
@CsvSource({ "true, 0, 1", "false, 1, 0" })
void click(boolean checked, int check, int uncheck) {
checkbox.checked = checked;
ClickEvent event = mock(ClickEvent.class);
checkbox.click(event);
verify(checkbox, times(check)).check(event);
verify(checkbox, times(uncheck)).uncheck(event);
assertEquals(!checked, checkbox.checked);
}
Aggregations