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