Search in sources :

Example 1 with ValueSource

use of org.junit.jupiter.params.provider.ValueSource 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)

Example 2 with ValueSource

use of org.junit.jupiter.params.provider.ValueSource in project sonar-go by SonarSource.

the class UastTest method parse_null_and_empty.

@ParameterizedTest
@ValueSource(strings = { "{}", "{ kinds: [], nativeNode: null, token: null, children: null, unknownElement: {} }", "{ kinds: [], nativeNode: '', token: null, children: [] }" })
void parse_null_and_empty(String json) throws Exception {
    Supplier<String> message = () -> "Assertion error for " + json;
    UastNode node = Uast.from(new StringReader(json));
    assertEquals(Collections.emptySet(), node.kinds, message);
    assertEquals("", node.nativeNode, message);
    assertNull(node.token, message);
    assertEquals(Collections.emptyList(), node.children, message);
}
Also used : StringReader(java.io.StringReader) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with ValueSource

use of org.junit.jupiter.params.provider.ValueSource in project harvest-client by 3AP-AG.

the class ExpensesApiCreateTest method attachReceiptException.

@ParameterizedTest
@ValueSource(strings = { "mp3.mp3" })
void attachReceiptException(String filename) throws IOException {
    try (InputStream in = getClass().getResourceAsStream("/minimal_files/" + filename)) {
        Expense creationInfo = ImmutableExpense.builder().project(project).expenseCategory(expenseCategory).spentDate(LocalDate.now()).user(user).totalCost(22.).build();
        expense = expensesApi.create(creationInfo);
        assertThrows(RequestProcessingException.class, () -> expense = expensesApi.attachReceipt(expense, in, filename));
    }
}
Also used : InputStream(java.io.InputStream) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with ValueSource

use of org.junit.jupiter.params.provider.ValueSource in project narchy by automenta.

the class NAL7Test method induction_on_events_composition_post.

@ValueSource(ints = { 0, 1, 2, 3, 4 })
@ParameterizedTest
public void induction_on_events_composition_post(int dt) {
    TestNAR tester = test;
    int t = 0;
    String component = "(open(John,door) &| hold(John,key))";
    tester.inputAt(t, component + ". :|:");
    tester.inputAt(t + dt, "enter(John,room). :|:");
    tester.mustBelieve((2 * (t + Math.max(2, dt)) + Math.max(2, dt) + 1), /**
     * approx
     */
    "(" + component + " ==>+" + dt + " enter(John,room))", 1.00f, 0.45f, t);
}
Also used : TestNAR(nars.test.TestNAR) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with ValueSource

use of org.junit.jupiter.params.provider.ValueSource in project logging-log4j2 by apache.

the class JsonTemplateLayoutConcurrentEncodeTest method test_concurrent_encode.

@ParameterizedTest
@ValueSource(strings = { "dummy", "threadLocal", "queue:supplier=java.util.concurrent.ArrayBlockingQueue.new", "queue:supplier=org.jctools.queues.MpmcArrayQueue.new" })
void test_concurrent_encode(final String recyclerFactory) throws IOException {
    final Path appenderFilepath = createAppenderFilepath(recyclerFactory);
    final int workerCount = 10;
    final int messageLength = 1_000;
    final int messageCount = 1_000;
    try {
        withContextFromTemplate(appenderFilepath, recyclerFactory, loggerContext -> {
            final Logger logger = loggerContext.getLogger(JsonTemplateLayoutConcurrentEncodeTest.class);
            runWorkers(workerCount, messageLength, messageCount, logger);
        });
        verifyLines(appenderFilepath, messageLength, workerCount * messageCount);
    } catch (final Throwable error) {
        final String message = String.format("test failure for appender pointing to file: `%s`", appenderFilepath);
        throw new AssertionError(message, error);
    }
    Files.delete(appenderFilepath);
}
Also used : Path(java.nio.file.Path) Logger(org.apache.logging.log4j.Logger) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)266 ValueSource (org.junit.jupiter.params.provider.ValueSource)266 HashSet (java.util.HashSet)23 HistogramTestUtils.constructDoubleHistogram (org.HdrHistogram.HistogramTestUtils.constructDoubleHistogram)23 ArrayList (java.util.ArrayList)22 HashMap (java.util.HashMap)20 ApiResponse (org.hisp.dhis.dto.ApiResponse)15 UpdateModel (com.synopsys.integration.alert.update.model.UpdateModel)13 File (java.io.File)13 List (java.util.List)13 OffsetDateTime (java.time.OffsetDateTime)10 Map (java.util.Map)10 TimeUnit (java.util.concurrent.TimeUnit)10 TopicPartition (org.apache.kafka.common.TopicPartition)9 ListenerSubscribeMessage (io.nem.symbol.sdk.infrastructure.ListenerSubscribeMessage)8 UnresolvedAddress (io.nem.symbol.sdk.model.account.UnresolvedAddress)8 ZooKeeper (org.apache.zookeeper.ZooKeeper)8 JsonObject (com.google.gson.JsonObject)7 IOException (java.io.IOException)7 CountDownLatch (java.util.concurrent.CountDownLatch)7