Search in sources :

Example 11 with ParameterizedTest

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

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

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

the class SalesforceControllerTest method testRequestCardRelatedAccountsSuccess.

@DisplayName("Card request sender related accounts cases")
@ParameterizedTest(name = "{index} ==> Language=''{1}''")
@CsvSource({ "successRelatedAccounts.json, " + StringUtils.EMPTY, "successRelatedAccounts_xx.json, xx" })
void testRequestCardRelatedAccountsSuccess(String resFile, String lang) throws Exception {
    /* In this case email sender details are not present in salesforce.
        Collect info about the accounts related to the sender's domain. */
    final String requestFile = "/connector/requests/request.json";
    expectSalesforceRequest(getContactRequestSoql(requestFile)).andRespond(withSuccess(sfResponseContactDoesNotExist, APPLICATION_JSON));
    expectSalesforceRequest(getAccountRequestSoql(requestFile)).andRespond(withSuccess(sfResponseAccounts, APPLICATION_JSON));
    // Opportunity requests for each account.
    expectSalesforceRequest(getAccountOpportunitySoql("001Q0000012gRPoIAM")).andRespond(withSuccess(sfResponseGeorgeMichaelOpportunities, APPLICATION_JSON));
    expectSalesforceRequest(getAccountOpportunitySoql("001Q0000012gkPHIAY")).andRespond(withSuccess(sfResponseLeoDCaprioOpportunities, APPLICATION_JSON));
    expectSalesforceRequest(getAccountOpportunitySoql("001Q0000012glcuIAA")).andRespond(withSuccess(sfResponseWordHowardOpportunities, APPLICATION_JSON));
    testRequestCards(requestFile, resFile, lang);
    mockSF.verify();
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) CsvSource(org.junit.jupiter.params.provider.CsvSource) DisplayName(org.junit.jupiter.api.DisplayName) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 14 with ParameterizedTest

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

the class BitbucketServerControllerTest method testRequestCardsWithMissingParameter.

@ParameterizedTest(name = "{index} ==> ''{0}''")
@DisplayName("Missing parameter cases")
@CsvSource({ "emptyRequest.json, emptyRequest.json", "emptyToken.json, emptyToken.json" })
void testRequestCardsWithMissingParameter(String requestFile, String responseFile) throws Exception {
    MockHttpServletRequestBuilder builder = requestCard(BITBUCKET_SERVER_AUTH_TOKEN, requestFile);
    perform(builder).andExpect(status().isBadRequest()).andExpect(content().contentTypeCompatibleWith(APPLICATION_JSON)).andExpect(content().json(fromFile("bitbucket/responses/" + responseFile)));
}
Also used : MockHttpServletRequestBuilder(org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) DisplayName(org.junit.jupiter.api.DisplayName)

Example 15 with ParameterizedTest

use of org.junit.jupiter.params.ParameterizedTest in project solution-finder by knewjade.

the class CheckerNoHoldTest method testCaseList.

@ParameterizedTest
@ArgumentsSource(TestCase.class)
@LongTest
void testCaseList(Pieces pieces, boolean expectedCount) throws Exception {
    int maxDepth = 10;
    int maxClearLine = 4;
    Field field = FieldFactory.createField(maxClearLine);
    // Initialize
    Candidate<Action> candidate = new LockedCandidate(minoFactory, minoShifter, minoRotation, maxClearLine);
    LockedReachable reachable = new LockedReachable(minoFactory, minoShifter, minoRotation, maxClearLine);
    // Assertion
    // Set test case
    List<Piece> piecesList = pieces.getPieces();
    // Execute
    boolean isSucceed = checker.check(field, pieces, candidate, maxClearLine, maxDepth);
    assertThat(isSucceed).isEqualTo(expectedCount);
    // Check result
    if (isSucceed)
        assertResult(field, maxClearLine, reachable, piecesList);
}
Also used : Field(core.field.Field) LockedCandidate(core.action.candidate.LockedCandidate) Action(common.datastore.action.Action) Piece(core.mino.Piece) LockedReachable(core.action.reachable.LockedReachable) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) LongTest(module.LongTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

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