java-helidon.client.libraries.mp.api_test.mustache Maven / Gradle / Ivy
{{>licenseInfo}}
package {{package}};
{{#imports}}import {{import}};
{{/imports}}
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.eclipse.microprofile.rest.client.RestClientBuilder;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
{{#appName}}
* {{{.}}} Test
*
{{/appName}}
* API tests for {{classname}}
*/
public class {{classname}}Test {
private static {{classname}} client;
private static final String baseUrl = "http://localhost:8080";
@BeforeAll
public static void setup() throws MalformedURLException {
client = RestClientBuilder.newBuilder()
.baseUrl(new URL(baseUrl))
.register(ApiException.class)
.build({{classname}}.class);
}
{{#operations}}{{#operation}}
/**
{{#summary}}
* {{summary}}
*
{{#notes}}
* {{.}}
*
{{/notes}}
{{/summary}}
* @throws ApiException
* if the Api call fails
*/
@Test
public void {{operationId}}Test() throws Exception {
{{#allParams}}
{{/allParams}}
//{{#returnType}}{{{.}}} response = {{/returnType}}client.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
//{{#returnType}}assertNotNull(response);{{/returnType}}
}
{{/operation}}{{/operations}}
}