handlebars.JavaMicronaut.api_test.mustache Maven / Gradle / Ivy
package {{package}};
{{#imports}}import {{import}};
{{/imports}}
import io.micronaut.http.HttpResponse;
import io.micronaut.http.HttpStatus;
import io.micronaut.test.annotation.MicronautTest;
import org.junit.jupiter.api.Test;
import javax.inject.Inject;
import java.util.*;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
@MicronautTest
class {{classname}}ControllerTest {
@Inject
private {{classname}} api;
{{#operations}}
{{#operation}}
{{#contents}}
@Test
void {{operationId}}{{#isForm}}WithForm{{/isForm}}Test() {
{{#parameters}}
{{{dataType}}} {{paramName}} = {{{example}}};
{{/parameters}}
try {
api.{{operationId}}({{#parameters}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/parameters}}).blockingGet();
} catch (UnsupportedOperationException e) {
assumeTrue(false, "API is not yet implemented");
}
}
{{/contents}}
{{/operation}}
{{/operations}}
}