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