github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/openapi-generator/templates/java/api_test.mustache (about) 1 {{>licenseInfo}} 2 3 package {{package}}; 4 5 import {{invokerPackage}}.ApiException; 6 {{#imports}}import {{import}}; 7 {{/imports}} 8 import org.junit.Test; 9 import org.junit.Ignore; 10 import org.junit.Assert; 11 12 {{^fullJavaUtil}} 13 import java.util.ArrayList; 14 import java.util.HashMap; 15 import java.util.List; 16 import java.util.Map; 17 18 {{/fullJavaUtil}} 19 /** 20 * API tests for {{classname}} 21 */ 22 public class {{classname}}Test { 23 24 private final {{classname}} api = new {{classname}}(); 25 26 {{#operations}} 27 {{#operation}} 28 /** 29 {{#summary}} 30 * {{summary}} 31 * 32 {{/summary}} 33 {{#notes}} 34 * {{notes}} 35 * 36 {{/notes}} 37 * @throws ApiException 38 * if the Api call fails 39 */ 40 @Test 41 public void {{operationId}}Test() throws ApiException { 42 //{{#allParams}} 43 //{{{dataType}}} {{paramName}} = null; 44 //{{/allParams}} 45 //{{#returnType}}{{{returnType}}} response = {{/returnType}}api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); 46 47 // TODO: test validations 48 } 49 {{/operation}} 50 {{/operations}} 51 }