Package dev.dokimos.core
Interface Task
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
-
Method Summary
Modifier and TypeMethodDescriptionRun the task on the givenExampleand produce outputs.static <T> TaskCreates aTaskthat produces a single typed value and stores it under the conventional"output"key, so callers can return a record, list, or other POJO from their task body instead of hand-building the output map.
-
Method Details
-
run
Run the task on the givenExampleand produce outputs.- Parameters:
example- the example containing inputs and expected outputs- Returns:
- the actual outputs produced by the task
-
typed
Creates aTaskthat produces a single typed value and stores it under the conventional"output"key, so callers can return a record, list, or other POJO from their task body instead of hand-building the output map.The produced value is read back type-safely via
actualOutputAs(...)on the resultingEvalTestCaseand is matched structurally byStructuralMatchEvaluator.Map guard: if
fnitself returns aMap, that map is used directly as the output map rather than being nested under"output". The map is assumed to useStringkeys.- Type Parameters:
T- the produced value type- Parameters:
fn- the function producing the output value for anExample(may return aMap, which is used as the output map directly)- Returns:
- a
Taskthat wraps the produced value under"output"(or uses a returned map directly) - Throws:
NullPointerException- iffnreturnsnull(the output map cannot hold a null value; use a rawTaskif an absent output is intended)
-