All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.java-micronaut.client.test.api_test.groovy.mustache Maven / Gradle / Ivy

package {{package}}

{{#imports}}import {{import}}
{{/imports}}
import io.micronaut.test.extensions.spock.annotation.MicronautTest
import spock.lang.Specification
import {{javaxPackage}}.inject.Inject
import spock.lang.Ignore
{{#wrapInHttpResponse}}
import io.micronaut.http.HttpResponse
{{/wrapInHttpResponse}}
import java.util.Arrays
import java.util.ArrayList
import java.util.HashMap
import java.util.List
import java.util.Map
import java.util.HashSet

/**
 * API tests for {{classname}}
 */
@MicronautTest
class {{classname}}Spec extends Specification {

    @Inject
    {{classname}} api
    {{#operations}}{{#operation}}
    /**
     * {{summary}}
     {{#notes}}
     *
     * {{notes}}
     {{/notes}}
     */
    @Ignore("Not Implemented")
    void '{{operationId}}() test'() {
        given:
        {{#allParams}}
        {{{vendorExtensions.baseType}}} {{paramName}} = {{{vendorExtensions.groovyExample}}}
        {{/allParams}}

        when:
        {{#wrapInHttpResponse}}
        HttpResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> response = api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#reactive}}.block(){{/reactive}}{{#returnType}}
        {{{returnType}}} body = response.body(){{/returnType}}
        {{/wrapInHttpResponse}}
        {{^wrapInHttpResponse}}
        {{#returnType}}{{#reactive}}{{{vendorExtensions.originalReturnType}}}{{/reactive}}{{^reactive}}{{{returnType}}}{{/reactive}} responseBody = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#reactive}}{{#vendorExtensions.isReturnFlux}}.blockLast(){{/vendorExtensions.isReturnFlux}}{{^vendorExtensions.isReturnFlux}}.block(){{/vendorExtensions.isReturnFlux}}{{/reactive}}
        {{/wrapInHttpResponse}}

        then:
        true
        // TODO: test validations
    }
    {{/operation}}{{/operations}}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy