alef 0.78.0

Opinionated polyglot binding generator for Rust libraries
Documentation
{#- Java test method template for JUnit 5

   Context variables:
   - method_name: method name (UpperCamelCase)
   - description: fixture description
   - builder_expressions: string containing pre-generated builder expressions (or empty)
   - setup_lines: list of setup line strings (e.g., handle creation)
   - throws_clause: " throws Exception" or ""
   - expects_error: boolean
   - declared_error_check: string containing the rendered declared-value assertion, or empty
   - call_expr: the complete function call expression
   - result_var: result variable name
   - returns_void: bool — whether the call returns void (Rust `()` / `Result<(),E>`)
   - void_not_error: bool — returns_void call whose only meaningful check is `not_error`;
     wraps call_expr in assertDoesNotThrow so the check is a real, visible assertion instead
     of a bare statement
   - assertions_body: string containing all rendered assertions
   - unrenderable_error_assertions: skip markers for error-path assertions this backend cannot render
#}

    @Test
    void test{{ method_name }}(){{ throws_clause }} {
        // {{ description }}
{% if expects_error %}
        // Wrap setup_lines + call_expr inside the lambda so error fixtures
        // catch failures at *any* step — including `<Type>.fromJson(...)`
        // calls that throw on malformed JSON (e.g. error fixtures with an
        // invalid enum value like `"purpose":"invalid-purpose"`). Mirrors
        // the C# `Assert.ThrowsAnyAsync(() => client.X(Type.FromJson(...)))`
        // pattern.
{% if declared_error_check %}
        Exception thrown = assertThrows(Exception.class, () -> {
{% else %}
        assertThrows(Exception.class, () -> {
{% endif %}
{% if builder_expressions %}
{{ builder_expressions }}
{% endif %}
{% for line in setup_lines %}
            {{ line }}
{% endfor %}
            {{ call_expr }};
        });
{% if declared_error_check %}
{{ declared_error_check }}
{% endif %}
{% if unrenderable_error_assertions %}
{{ unrenderable_error_assertions }}
{% endif %}
{% else %}
{% if builder_expressions %}
{{ builder_expressions }}
{% endif %}
{% for line in setup_lines %}
        {{ line }}
{% endfor %}
{% if returns_void %}
{% if void_not_error %}
        assertDoesNotThrow(() -> {{ call_expr }});
{% else %}
        {{ call_expr }};
{% endif %}
{% else %}
        var {{ result_var }} = {{ call_expr }};
{% endif %}
{% if collect_snippet %}
        {{ collect_snippet }}
{% endif %}
{{ assertions_body }}
{% endif %}
{{ teardown_block }}
    }