Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Add a call stub and builder for exercising ValueAssertions #12

Open
teabot opened this issue Jun 11, 2015 · 0 comments
Open

Add a call stub and builder for exercising ValueAssertions #12

teabot opened this issue Jun 11, 2015 · 0 comments

Comments

@teabot
Copy link
Contributor

teabot commented Jun 11, 2015

Plunger has the FunctionCallStub, BufferCallStub, and AggregatorCallStub classes that can be used to concisely exercise Function, Buffer, and Aggregator operations with test data. These stubs handle the basic life cycle of the operations, also providing a store for any context that they might create.

However, the ValueAssertion operation type does not currently have such a stub (and associated builder class) available. This makes it harder to test ValueAssertion implementations than need be. A ValueAssertionCallStub should be provided to fill this void. It can likely be based on the existing stubs and possible extend AbstractOperationCallStub.

What differentiates this call stub from the others is that value on which we can make an assertion. Existing operations return Tuples, but the ValueAssertion either throws

An example usage might look like:

ValueAssertion assertion = new AssertDateValid();

stubCall = Plunger.newAssertionCallStubBuilder(FIELDS)
    .addTuple("2013-01-01")
    .addTuple("NOT_A_DATE")
    .build()
    .complete(mockFlowProcess, assertion);

List<AssertionException> result = stubCall.result();
assertThat(collected.get(0), is(nullValue());
assertThat(collected.get(1).getMessage(), is("argument 'TXN_DATE' value was not a valid date, in tuple: ['NOT_A_DATE']");
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant