Search in sources :

Example 1 with AnalyzeSyntaxRequest

use of com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest in project google-cloud-java by GoogleCloudPlatform.

the class LanguageServiceClientTest method analyzeSyntaxTest.

@Test
@SuppressWarnings("all")
public void analyzeSyntaxTest() {
    String language = "language-1613589672";
    AnalyzeSyntaxResponse expectedResponse = AnalyzeSyntaxResponse.newBuilder().setLanguage(language).build();
    mockLanguageService.addResponse(expectedResponse);
    Document document = Document.newBuilder().build();
    EncodingType encodingType = EncodingType.NONE;
    AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document, encodingType);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<GeneratedMessageV3> actualRequests = mockLanguageService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    AnalyzeSyntaxRequest actualRequest = (AnalyzeSyntaxRequest) actualRequests.get(0);
    Assert.assertEquals(document, actualRequest.getDocument());
    Assert.assertEquals(encodingType, actualRequest.getEncodingType());
}
Also used : AnalyzeSyntaxRequest(com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest) EncodingType(com.google.cloud.language.v1beta2.EncodingType) Document(com.google.cloud.language.v1beta2.Document) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) AnalyzeSyntaxResponse(com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse) Test(org.junit.Test)

Example 2 with AnalyzeSyntaxRequest

use of com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest in project google-cloud-java by GoogleCloudPlatform.

the class LanguageServiceClientTest method analyzeSyntaxTest.

@Test
@SuppressWarnings("all")
public void analyzeSyntaxTest() {
    String language = "language-1613589672";
    AnalyzeSyntaxResponse expectedResponse = AnalyzeSyntaxResponse.newBuilder().setLanguage(language).build();
    mockLanguageService.addResponse(expectedResponse);
    Document document = Document.newBuilder().build();
    EncodingType encodingType = EncodingType.NONE;
    AnalyzeSyntaxResponse actualResponse = client.analyzeSyntax(document, encodingType);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<GeneratedMessageV3> actualRequests = mockLanguageService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    AnalyzeSyntaxRequest actualRequest = (AnalyzeSyntaxRequest) actualRequests.get(0);
    Assert.assertEquals(document, actualRequest.getDocument());
    Assert.assertEquals(encodingType, actualRequest.getEncodingType());
}
Also used : AnalyzeSyntaxRequest(com.google.cloud.language.v1.AnalyzeSyntaxRequest) EncodingType(com.google.cloud.language.v1.EncodingType) Document(com.google.cloud.language.v1.Document) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) AnalyzeSyntaxResponse(com.google.cloud.language.v1.AnalyzeSyntaxResponse) Test(org.junit.Test)

Aggregations

GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)2 Test (org.junit.Test)2 AnalyzeSyntaxRequest (com.google.cloud.language.v1.AnalyzeSyntaxRequest)1 AnalyzeSyntaxResponse (com.google.cloud.language.v1.AnalyzeSyntaxResponse)1 Document (com.google.cloud.language.v1.Document)1 EncodingType (com.google.cloud.language.v1.EncodingType)1 AnalyzeSyntaxRequest (com.google.cloud.language.v1beta2.AnalyzeSyntaxRequest)1 AnalyzeSyntaxResponse (com.google.cloud.language.v1beta2.AnalyzeSyntaxResponse)1 Document (com.google.cloud.language.v1beta2.Document)1 EncodingType (com.google.cloud.language.v1beta2.EncodingType)1