OpenAPITools/openapi-generator · error · RuntimeException
Test tool "{testTool}" is not supported or misspelled.
Error message
Test tool "{testTool}" is not supported or misspelled. What it means
Thrown by JavaMicronautAbstractCodegen.processOpts while validating the 'test' additional property (OPT_TEST) for the java-micronaut / java-micronaut-server generators. The switch only wires two test frameworks: 'junit' (OPT_TEST_JUNIT) and 'spock' (OPT_TEST_SPOCK, Groovy-based); any other string aborts generation before any file is written. If 'test' is not supplied, the generator defaults to junit.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaMicronautAbstractCodegen.java:287
case OPT_BUILD_GRADLE:
case OPT_BUILD_MAVEN:
case OPT_BUILD_ALL:
this.buildTool = (String) additionalProperties.get(OPT_BUILD);
break;
default:
throw new RuntimeException("Build tool \"" + additionalProperties.get(OPT_BUILD) + "\" is not supported or misspelled.");
}
}
additionalProperties.put(OPT_BUILD, buildTool);
if (additionalProperties.containsKey(OPT_TEST)) {
switch ((String) additionalProperties.get(OPT_TEST)) {
case OPT_TEST_JUNIT:
case OPT_TEST_SPOCK:
this.testTool = (String) additionalProperties.get(OPT_TEST);
break;
default:
throw new RuntimeException("Test tool \"" + additionalProperties.get(OPT_TEST) + "\" is not supported or misspelled.");
}
}
additionalProperties.put(OPT_TEST, testTool);
if (testTool.equals(OPT_TEST_JUNIT)) {
additionalProperties.put("isTestJunit", true);
} else if (testTool.equals(OPT_TEST_SPOCK)) {
additionalProperties.put("isTestSpock", true);
}
if (additionalProperties.containsKey(OPT_GENERATE_SWAGGER_ANNOTATIONS)) {
String value = String.valueOf(additionalProperties.get(OPT_GENERATE_SWAGGER_ANNOTATIONS));
switch (value) {
case OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_1:
this.generateSwaggerAnnotations = OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_1;
break;
case OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_2:
case OPT_GENERATE_SWAGGER_ANNOTATIONS_TRUE:
this.generateSwaggerAnnotations = OPT_GENERATE_SWAGGER_ANNOTATIONS_SWAGGER_2;View on GitHub (pinned to fcec517be3)
Solutions
- Set `-p test=junit` or `-p test=spock` (exact, case-sensitive strings).
- Omit the 'test' option entirely — the generator defaults to junit.
- If you pasted options from another generator's docs, re-check against `openapi-generator-cli config-help -g java-micronaut-server`, which lists exactly junit and spock for testToolMap.
- Inspect the value in your config file for trailing spaces or non-ASCII quotes.
Example fix
# before openapi-generator-cli generate -g java-micronaut-server -i api.yaml -p test=junit5 # after openapi-generator-cli generate -g java-micronaut-server -i api.yaml -p test=junit
Defensive patterns
Strategy: validation
Validate before calling
# shell: gate the option before invoking the CLI
test_tool="${TEST_TOOL:-junit}"
case "$test_tool" in
junit|spock) ;;
*) echo "test must be 'junit' or 'spock', got: $test_tool" >&2; exit 2 ;;
esac
openapi-generator-cli generate -g java-micronaut-server -i api.yaml -p test="$test_tool" Type guard
private static final java.util.Set<String> MICRONAUT_TEST_TOOLS = java.util.Set.of("junit", "spock");
boolean isValidMicronautTestTool(String value) {
return value != null && MICRONAUT_TEST_TOOLS.contains(value);
} Try / catch
try {
new DefaultGenerator().opts(clientOptInput).generate();
} catch (RuntimeException e) {
// deterministic config error: report and stop, never retry
throw new IllegalStateException("Micronaut generator config rejected: " + e.getMessage(), e);
} Prevention
- Keep per-generator option allowlists in one build script instead of hand-typed -p flags.
- Run `openapi-generator-cli config-help -g java-micronaut-server` once and pin the printed enum values.
- Treat any 'not supported or misspelled' message as a typo in an option value, not a generator bug.
When it happens
Trigger: Running `openapi-generator-cli generate -g java-micronaut-server -i api.yaml -p test=junit5` (or any value other than exactly 'junit' or 'spock': 'Junit', 'spock2', 'testng', 'junit-jupiter'). Also reachable via the additionalProperties block of a YAML/JSON config file, or programmatically through addAdditionalProperty("test", value).
Common situations: Copying CLI options from a Spring/Quarkus generator recipe that names test frameworks differently (junit5, junit-jupiter); assuming version-suffixed names are aliases; stray whitespace or smart quotes around the value in YAML/JSON config files.
Related errors
- Build tool "{buildTool}" is not supported or misspelled.
- Value "{value}" for the generateSwaggerAnnotations parameter
- {serializationLibrary} is an invalid enum property naming op
- useJackson3 is only supported for the 'native', 'apache-http
- Invalid microprofileFramework '{microprofileFramework}'. Mus
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/e3fe5f35c0902ae8.
Report an issue: GitHub.