use of io.helidon.build.archetype.engine.v2.InvocationException in project helidon-build-tools by oracle.
the class InputResolverTest method testInvalidEnumExternalValue.
@Test
void testInvalidEnumExternalValue() {
Block block = step("step", inputEnum("enum-input", null, inputOption("option1", "value1"))).build();
Context context = Context.create(null, Map.of("enum-input", ""), null);
InvocationException ex = assertThrows(InvocationException.class, () -> resolveInputs(block, context, null));
assertThat(ex.getCause(), is(instanceOf(InvalidInputException.class)));
assertThat(ex.getCause().getMessage(), is("Invalid input: enum-input=''"));
}
use of io.helidon.build.archetype.engine.v2.InvocationException in project helidon-build-tools by oracle.
the class InputTreeTest method testTextNoDefault.
@Test
void testTextNoDefault() {
InputTree.Builder builder = InputTree.builder().archetypePath(sourceDir("input-tree")).entryPointFile("text-no-default.xml");
InvocationException e = assertThrows(InvocationException.class, builder::build);
assertThat(e.getCause().getMessage(), is("Unresolved input: text 'foo' requires a default value"));
}
use of io.helidon.build.archetype.engine.v2.InvocationException in project helidon-build-tools by oracle.
the class InputResolverTest method testInvalidGlobalInputs.
@Test
void testInvalidGlobalInputs() {
Block.Builder invalidGlobal = inputEnum("invalid-global", "value1", inputOption("option1", "value1", output(model(modelList("colors", modelValue("red"))))), inputOption("option2", "value2", output(model(modelList("colors", modelValue("blue")))))).attribute("optional", Value.TRUE).attribute("global", Value.TRUE);
Block.Builder nested = inputEnum("nested", "value1", inputOption("option1", "value1", invalidGlobal));
Block global = step("step", inputEnum("global", "value1", inputOption("option1", "value1", nested)).attribute("global", Value.TRUE)).build();
Context context = Context.create();
context.setValue("global", Value.create("value1"), ContextValue.ValueKind.EXTERNAL);
context.setValue("global.nested", Value.create("value1"), ContextValue.ValueKind.EXTERNAL);
InvocationException ex = assertThrows(InvocationException.class, () -> resolveInputs(global, context, null));
assertThat(ex.getCause(), is(instanceOf(IllegalStateException.class)));
assertThat(ex.getCause().getMessage(), endsWith("Parent input is not global"));
}
Aggregations