github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/openapi-generator/templates/java/libraries/vertx/api_test.mustache (about) 1 {{>licenseInfo}} 2 package {{package}}; 3 4 {{#imports}}import {{import}}; 5 {{/imports}} 6 7 import {{invokerPackage}}.Configuration; 8 9 import org.junit.Test; 10 import org.junit.Ignore; 11 import org.junit.BeforeClass; 12 import org.junit.Rule; 13 import org.junit.runner.RunWith; 14 15 import io.vertx.core.AsyncResult; 16 import io.vertx.core.Handler; 17 import io.vertx.core.json.JsonObject; 18 import io.vertx.core.Vertx; 19 import io.vertx.ext.unit.junit.VertxUnitRunner; 20 import io.vertx.ext.unit.junit.RunTestOnContext; 21 import io.vertx.ext.unit.TestContext; 22 import io.vertx.ext.unit.Async; 23 24 {{^fullJavaUtil}} 25 import java.util.ArrayList; 26 import java.util.HashMap; 27 import java.util.List; 28 import java.util.Map; 29 {{/fullJavaUtil}} 30 31 /** 32 * API tests for {{classname}} 33 */ 34 @RunWith(VertxUnitRunner.class) 35 @Ignore 36 public class {{classname}}Test { 37 38 private {{classname}} api; 39 40 @Rule 41 public RunTestOnContext rule = new RunTestOnContext(); 42 43 @BeforeClass 44 public void setupApiClient() { 45 JsonObject config = new JsonObject(); 46 Vertx vertx = rule.vertx(); 47 Configuration.setupDefaultApiClient(vertx, config); 48 49 api = new {{classname}}Impl(); 50 } 51 {{#operations}}{{#operation}} 52 /** 53 * {{summary}} 54 * {{notes}} 55 * 56 * @param context Vertx test context for doing assertions 57 */ 58 @Test 59 public void {{operationId}}Test(TestContext context) { 60 Async async = context.async(); 61 {{#allParams}} 62 {{{dataType}}} {{paramName}} = null; 63 {{/allParams}} 64 api.{{operationId}}({{#allParams}}{{paramName}}, {{/allParams}}result -> { 65 // TODO: test validations 66 async.complete(); 67 }); 68 } 69 {{/operation}}{{/operations}} 70 }