LUISGrammarEvaluator implements GrammarEvaluator { @Override public Object getSemanticInterpretation(final DataModel model, String utterance) { final HttpClientBuilder builder = HttpClientBuilder.create(); if (PROXY_HOST != null) { HttpHost proxy = new HttpHost(PROXY_HOST, PROXY_PORT); builder.setProxy(proxy); } try (CloseableHttpClient client = builder.build()){ final URIBuilder uribuilder = new URIBuilder(grammarUri); uribuilder.addParameter("subscription-key", subscriptionKey); uribuilder.addParameter("q", utterance); final URI uri = uribuilder.build(); final HttpGet request = new HttpGet(uri); final HttpResponse response = client.execute(request); final StatusLine statusLine = response.getStatusLine(); final int status = statusLine.getStatusCode(); if (status != HttpStatus.SC_OK) { final String reasonPhrase = statusLine.getReasonPhrase(); LOGGER.error("error accessing '" + uri +"': " + reasonPhrase + " (HTTP error code " + status + ")"); return null; } final HttpEntity entity = response.getEntity(); final InputStream input = entity.getContent(); final Object interpretation = parseLUISResponse(model, input); return interpretation; } catch (IOException | URISyntaxException | ParseException | SemanticError e) { LOGGER.error(e.getMessage(), e); return null; } } LUISGrammarEvaluator(final String subscription,
            final URI documentURI); @Override URI getURI(); @Override Object getSemanticInterpretation(final DataModel model,
            String utterance);  }
@Test public void testGetSemanticInterpretation() throws URISyntaxException, IOException { final TestProperties properties = new TestProperties(); final String subscription = properties.get("luis.subscription-key"); final String applicationId = properties .get("luis.pizza-application-id"); final URI uri = new URI( "https: + applicationId); LUISGrammarEvaluator evaluator = new LUISGrammarEvaluator(subscription, uri); DataModel model = new EcmaScriptDataModel(); model.createScope(); final Object result = evaluator.getSemanticInterpretation(model, "I want a large pizza with salami"); Assert.assertNotNull("interpretation must no be null", result); }