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

handlebars.JavaSpring.libraries.spring-mvc.api_test.mustache Maven / Gradle / Ivy

There is a newer version: 1.0.54
Show newest version
package {{package}};

{{#imports}}import {{import}};
{{/imports}}

import java.util.*;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;

import org.testng.annotations.Test;
import static org.junit.Assert.assertEquals;

/**
 * Test class to verify that GET endpoints on generated project are reached.
 */
public class {{classname}}ControllerIT {

    {{#operations}}
    {{#operation}}
    {{#vendorExtensions.x-is-get-method}}
    @Test
    public void {{operationId}}Test() throws Exception {
        final String requestURL = "http://localhost:8002{{^contextPath}}/{{/contextPath}}{{#contextPath}}{{contextPath}}{{/contextPath}}{{testPath}}{{#hasQueryParams}}?{{/hasQueryParams}}{{#queryParams}}{{paramName}}={{testExample}}{{#hasMore}}&{{/hasMore}}{{/queryParams}}";
        final HttpClient client = HttpClientBuilder.create().build();
        final HttpResponse response = client.execute(new HttpGet(requestURL));
        assertEquals(response.getStatusLine().getStatusCode(), 501);
    }
    {{/vendorExtensions.x-is-get-method}}
    {{/operation}}
    {{/operations}}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy