Search in sources :

Example 1 with ParameterizedTest

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);
}
Also used : TServiceTemplate(org.eclipse.winery.model.tosca.yaml.TServiceTemplate) DisplayName(org.junit.jupiter.api.DisplayName) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 2 with ParameterizedTest

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());
}
Also used : ICombatEntity(de.gurkenlabs.litiengine.entities.ICombatEntity) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with ParameterizedTest

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));
}
Also used : Command(com.karuslabs.commons.command.Command) Arguments(com.karuslabs.commons.command.arguments.Arguments) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with ParameterizedTest

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);
}
Also used : Window(com.karuslabs.commons.graphics.windows.Window) InventoryCloseEvent(org.bukkit.event.inventory.InventoryCloseEvent) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with ParameterizedTest

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);
}
Also used : ClickEvent(com.karuslabs.commons.graphics.ClickEvent) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1880 MethodSource (org.junit.jupiter.params.provider.MethodSource)1020 EnumSource (org.junit.jupiter.params.provider.EnumSource)321 ValueSource (org.junit.jupiter.params.provider.ValueSource)270 ArgumentsSource (org.junit.jupiter.params.provider.ArgumentsSource)181 Transaction (org.neo4j.graphdb.Transaction)117 ArrayList (java.util.ArrayList)97 ByteBuffer (java.nio.ByteBuffer)78 CsvSource (org.junit.jupiter.params.provider.CsvSource)78 Path (java.nio.file.Path)71 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)67 IOException (java.io.IOException)65 List (java.util.List)59 Test (org.junit.jupiter.api.Test)58 HashMap (java.util.HashMap)55 Map (java.util.Map)54 HashSet (java.util.HashSet)52 lombok.val (lombok.val)52 SelfSignedCertificate (io.netty.handler.ssl.util.SelfSignedCertificate)50 TimeUnit (java.util.concurrent.TimeUnit)48