use of org.junit.jupiter.params.ParameterizedTest in project siesta by cadenzauk.
the class ExpressionBuilderTest method testExpression.
@ParameterizedTest
@MethodSource("argsForTestExpression")
void testExpression(BiFunction<ExpressionBuilder<String, InWhereExpectingAnd<String>>, Alias<SalespersonRow>, InWhereExpectingAnd<String>> method, String expectedSql, Object[] expectedArgs) {
MockitoAnnotations.initMocks(this);
Database database = testDatabase(new AnsiDialect());
Alias<SalespersonRow> alias = database.table(SalespersonRow.class).as("s");
ExpressionBuilder<String, InWhereExpectingAnd<String>> select = database.from(alias).select(SalespersonRow::firstName, "name").where(SalespersonRow::firstName);
method.apply(select, alias).list(transaction);
verify(transaction).query(sql.capture(), args.capture(), any());
assertThat(sql.getValue(), is("select s.FIRST_NAME as name from SIESTA.SALESPERSON s where s.FIRST_NAME " + expectedSql));
assertThat(args.getValue(), is(expectedArgs));
}
use of org.junit.jupiter.params.ParameterizedTest in project siesta by cadenzauk.
the class FunctionTest method functionTest.
@ParameterizedTest
@MethodSource("parametersForFunctionTest")
void functionTest(Function<Alias<TestRow>, TypedExpression<?>> sutSupplier, String expectedSql, Object[] expectedArgs) {
MockitoAnnotations.initMocks(this);
Database database = testDatabase(new AnsiDialect());
Alias<TestRow> alias = database.table(TestRow.class).as("s");
database.from(alias).select(sutSupplier.apply(alias), "foo").list(transaction);
verify(transaction).query(sql.capture(), args.capture(), rowMapper.capture());
assertThat(sql.getValue(), is("select " + expectedSql + " as foo from SIESTA.TEST_TABLE s"));
assertThat(args.getValue(), is(expectedArgs));
}
use of org.junit.jupiter.params.ParameterizedTest 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);
}
use of org.junit.jupiter.params.ParameterizedTest in project qpp-conversion-tool by CMSgov.
the class CpcClinicalDocumentValidatorTest method testCpcPlusSubmissionAfterEndDate.
@ParameterizedTest
@CsvSource({ "meep@mawp.blah, meep@mawp.blah", ", cpcplus@telligen.com" })
void testCpcPlusSubmissionAfterEndDate(String systemValue, String expected) {
LocalDate endDate = LocalDate.now().minusYears(3);
String formattedDate = endDate.format(CpcClinicalDocumentValidator.END_DATE_FORMAT);
if (systemValue != null) {
System.setProperty(CpcClinicalDocumentValidator.CPC_PLUS_CONTACT_EMAIL, systemValue);
}
System.setProperty(CpcClinicalDocumentValidator.END_DATE_VARIABLE, endDate.toString());
Node clinicalDocument = createValidCpcPlusClinicalDocument();
cpcValidator.internalValidateSingleNode(clinicalDocument);
assertThat(cpcValidator.getDetails()).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.CPC_PLUS_SUBMISSION_ENDED.format(formattedDate, expected));
}
use of org.junit.jupiter.params.ParameterizedTest in project qpp-conversion-tool by CMSgov.
the class MeasureDataEncoderTest method testDenominator.
@DisplayName("Verify measure data retrieval")
@ParameterizedTest(name = "retrieval of ''{0}''")
@EnumSource(Fixture.class)
void testDenominator(Fixture fixture) throws EncodeException {
Node measureDataNode = setUpMeasureDataNode(fixture.name());
JsonWrapper jsonWrapper = encode(measureDataNode);
assertThat(jsonWrapper.getInteger(fixture.value)).isEqualTo(900);
}
Aggregations