Search in sources :

Example 1 with Window

use of com.karuslabs.commons.graphics.windows.Window 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 2 with Window

use of com.karuslabs.commons.graphics.windows.Window in project Karus-Commons by Pante.

the class CheckBoxTest method reset.

@ParameterizedTest
@CsvSource({ "true, 1, false", "false, 0, true" })
void reset(boolean reset, int times, boolean expected) {
    checkbox.checked = true;
    checkbox.reset(reset);
    Window window = mock(Window.class);
    InventoryCloseEvent event = mock(InventoryCloseEvent.class);
    checkbox.reset(window, event);
    verify(event, times(times)).getInventory();
    assertEquals(expected, checkbox.checked);
}
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 3 with Window

use of com.karuslabs.commons.graphics.windows.Window in project Karus-Commons by Pante.

the class AbstractRegionTest method open.

@Test
void open() {
    Window window = mock(Window.class);
    InventoryOpenEvent event = mock(InventoryOpenEvent.class);
    region.open(window, event);
    verify(region).onOpen(window, event);
    verify(button).open(window, event);
}
Also used : Window(com.karuslabs.commons.graphics.windows.Window) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with Window

use of com.karuslabs.commons.graphics.windows.Window in project Karus-Commons by Pante.

the class AbstractRegionTest method reset.

@ParameterizedTest
@CsvSource({ "true, 1", "false, 0" })
void reset(boolean reset, int times) {
    Window window = mock(Window.class);
    InventoryCloseEvent event = mock(InventoryCloseEvent.class);
    region.reset(reset);
    region.reset(window, event);
    verify(event, times(times)).getInventory();
    verify(button, times(times)).reset(window, event);
}
Also used : Window(com.karuslabs.commons.graphics.windows.Window) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with Window

use of com.karuslabs.commons.graphics.windows.Window in project Karus-Commons by Pante.

the class AbstractRegionTest method close.

@Test
void close() {
    Window window = mock(Window.class);
    InventoryCloseEvent event = mock(InventoryCloseEvent.class);
    region.close(window, event);
    verify(region).onClose(window, event);
    verify(button).close(window, event);
}
Also used : Window(com.karuslabs.commons.graphics.windows.Window) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

Window (com.karuslabs.commons.graphics.windows.Window)7 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7 Test (org.junit.jupiter.api.Test)4 CsvSource (org.junit.jupiter.params.provider.CsvSource)3 InventoryCloseEvent (org.bukkit.event.inventory.InventoryCloseEvent)2