Search in sources :

Example 1 with MethodSource

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

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

the class OpenSslPvkUtilTest method checkCompatibilityWithBC.

@ParameterizedTest
@MethodSource("privateKeys")
public void checkCompatibilityWithBC(PrivateKey privateKey) throws Exception {
    String key = OpenSslPvkUtil.getPem(privateKey);
    try (PEMParser pemParser = new PEMParser(new StringReader(key))) {
        Object obj = pemParser.readObject();
        assertThat(obj).isInstanceOf(PEMKeyPair.class);
        KeyPair keyPair = new JcaPEMKeyConverter().getKeyPair((PEMKeyPair) obj);
        assertThat(keyPair.getPrivate()).isEqualTo(privateKey);
    }
}
Also used : KeyPair(java.security.KeyPair) PEMKeyPair(org.bouncycastle.openssl.PEMKeyPair) PEMParser(org.bouncycastle.openssl.PEMParser) StringReader(java.io.StringReader) JcaPEMKeyConverter(org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 3 with MethodSource

use of org.junit.jupiter.params.provider.MethodSource in project connectors-workspace-one by vmware.

the class SalesforceControllerTest method testRequestCardContactDetailsSuccess.

@DisplayName("Card request contact details cases")
@ParameterizedTest(name = "{index} ==> Response=''{2}'', Language=''{3}''")
@MethodSource("contactCardTestArgProvider")
void testRequestCardContactDetailsSuccess(Resource contactResponse, Resource contactOppResponse, String resFile, String lang) throws Exception {
    final String requestFile = "/connector/requests/request.json";
    expectSalesforceRequest(getContactRequestSoql(requestFile)).andRespond(withSuccess(contactResponse, APPLICATION_JSON));
    expectSalesforceRequest(getContactOpportunitySoql(requestFile)).andRespond(withSuccess(contactOppResponse, APPLICATION_JSON));
    testRequestCards(requestFile, resFile, lang);
    mockSF.verify();
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) DisplayName(org.junit.jupiter.api.DisplayName) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 4 with MethodSource

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

the class ExceptionsTest method testGeneric.

@ParameterizedTest(name = "http code {1} should throw {0}")
@MethodSource("createCases")
void testGeneric(Class<HarvestHttpException> exceptionClass, int code) {
    server.enqueue(new MockResponse().setBody(ERROR_JSON).setResponseCode(code));
    // Harvest init does one request for the company
    HarvestHttpException httpException = assertThrows(exceptionClass, this::startServer);
    assertThat(httpException.getHttpCode()).isEqualTo(code);
}
Also used : MockResponse(okhttp3.mockwebserver.MockResponse) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 5 with MethodSource

use of org.junit.jupiter.params.provider.MethodSource in project siesta by cadenzauk.

the class DataTypeTest method get.

@ParameterizedTest
@MethodSource("parametersForGet")
<T> void get(DataType<T> sut, SqlBiConsumer<ResultSet, String> resultSetExtractor, Optional<ZoneId> dbTimeZone, T expected) throws SQLException {
    resultSetExtractor.accept(rs, "someColumn");
    when(db.dialect()).thenReturn(new AnsiDialect());
    dbTimeZone.ifPresent(zone -> when(db.databaseTimeZone()).thenReturn(zone));
    Optional<T> result = sut.get(rs, "someColumn", db);
    assertThat(result, is(Optional.of(expected)));
}
Also used : AnsiDialect(com.cadenzauk.siesta.dialect.AnsiDialect) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

MethodSource (org.junit.jupiter.params.provider.MethodSource)1021 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1020 Transaction (org.neo4j.graphdb.Transaction)103 lombok.val (lombok.val)52 SelfSignedCertificate (io.netty.handler.ssl.util.SelfSignedCertificate)50 ArrayList (java.util.ArrayList)49 IOException (java.io.IOException)47 Stream (java.util.stream.Stream)46 SSLEngine (javax.net.ssl.SSLEngine)44 Node (org.neo4j.graphdb.Node)42 Map (java.util.Map)41 Test (org.junit.jupiter.api.Test)41 Path (java.nio.file.Path)40 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)38 List (java.util.List)35 TimeUnit (java.util.concurrent.TimeUnit)35 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)35 CountDownLatch (java.util.concurrent.CountDownLatch)34 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)32 InterruptAfter (io.aeron.test.InterruptAfter)30