Search in sources :

Example 6 with ParameterizedTest

use of org.junit.jupiter.params.ParameterizedTest 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 7 with ParameterizedTest

use of org.junit.jupiter.params.ParameterizedTest in project Karus-Commons by Pante.

the class CyclicButtonTest method reset.

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

use of org.junit.jupiter.params.ParameterizedTest in project Karus-Commons by Pante.

the class WaveTest method render.

@ParameterizedTest
@CsvSource({ "1, 0", "0, 1" })
void render(int steps, int times) {
    context.steps = steps;
    doNothing().when(wave).process(origin);
    Vector water = new Vector(0, 0, 1);
    Vector cloud = new Vector(0, 0, 2);
    wave.waters.add(water);
    wave.clouds.add(cloud);
    wave.render(context, origin, target, offset);
    verify(wave, times(times)).process(origin);
    verify(context).render(PARTICLES, origin, water);
    verify(context).render(COLOURED, origin, cloud);
}
Also used : Vector(org.bukkit.util.Vector) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 9 with ParameterizedTest

use of org.junit.jupiter.params.ParameterizedTest in project keystore-explorer by kaikramer.

the class KeyPairUtilTest method generateRsaDsaKeys.

@ParameterizedTest
@CsvSource({ "DSA, 512", "DSA, 1024", "RSA, 512", "RSA, 1024", "RSA, 2048" // "RSA, 3072", takes too long
// "RSA, 4096", takes too long
})
public void generateRsaDsaKeys(KeyPairType keyPairType, Integer keySize) throws Exception {
    KeyPair keyPair = KeyPairUtil.generateKeyPair(keyPairType, keySize, BC);
    PrivateKey privateKey = keyPair.getPrivate();
    KeyInfo privateKeyInfo = KeyPairUtil.getKeyInfo(privateKey);
    assertEquals(keyPairType.toString(), privateKeyInfo.getAlgorithm());
    assertEquals(keySize, privateKeyInfo.getSize());
    PublicKey publicKey = keyPair.getPublic();
    KeyInfo publicKeyInfo = KeyPairUtil.getKeyInfo(publicKey);
    assertEquals(keyPairType.toString(), publicKeyInfo.getAlgorithm());
    assertEquals(keySize, publicKeyInfo.getSize());
    assertTrue(KeyPairUtil.validKeyPair(privateKey, publicKey));
}
Also used : KeyPair(java.security.KeyPair) PrivateKey(java.security.PrivateKey) KeyInfo(org.kse.crypto.KeyInfo) PublicKey(java.security.PublicKey) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 10 with ParameterizedTest

use of org.junit.jupiter.params.ParameterizedTest in project keystore-explorer by kaikramer.

the class KeyPairUtilTest method generateEcKeys.

@ParameterizedTest
@ValueSource(strings = { // NIST curves
"B-163", "B-233", "B-283", "B-409", "B-571", "K-163", "K-233", "K-283", "K-409", "K-571", "P-192", "P-224", "P-256", "P-384", "P-521", // SEC curves
"secp112r1", "secp112r2", "secp128r1", "secp128r2", "secp160k1", "secp160r1", "secp160r2", "secp192k1", "secp192r1", "secp224k1", "secp224r1", "secp256k1", "secp256r1", "secp384r1", "secp521r1", "sect113r1", "sect113r2", "sect131r1", "sect131r2", "sect163k1", "sect163r1", "sect163r2", "sect193r1", "sect193r2", "sect233k1", "sect233r1", "sect239k1", "sect283k1", "sect283r1", "sect409k1", "sect409r1", "sect571k1", "sect571r1", // ANSI X9.62 curves
"prime192v1", "prime192v2", "prime192v3", "prime239v1", "prime239v2", "prime239v3", "prime256v1", "c2pnb163v1", "c2pnb163v2", "c2pnb163v3", "c2pnb176w1", "c2tnb191v1", "c2tnb191v2", "c2tnb191v3", "c2tnb239v1", "c2tnb239v2", "c2tnb239v3", "c2tnb359v1", "c2tnb431r1", "c2pnb208w1", "c2pnb272w1", "c2pnb304w1", "c2pnb368w1", // Brainpool curves
"brainpoolP160r1", "brainpoolP160t1", "brainpoolP192r1", "brainpoolP192t1", "brainpoolP224r1", "brainpoolP224t1", "brainpoolP256r1", "brainpoolP256t1", "brainpoolP320r1", "brainpoolP320t1", "brainpoolP384r1", "brainpoolP384t1", "brainpoolP512r1", "brainpoolP512t1" })
public void generateEcKeys(String curveName) throws Exception {
    KeyPair keyPair = KeyPairUtil.generateECKeyPair(curveName, BC);
    assertTrue(KeyPairUtil.validKeyPair(keyPair.getPrivate(), keyPair.getPublic()));
}
Also used : KeyPair(java.security.KeyPair) ValueSource(org.junit.jupiter.params.provider.ValueSource) 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