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);
}
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());
}
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);
}
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));
}
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()));
}
Aggregations