use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class LanguageServiceClientTest method analyzeEntitySentimentTest.
@Test
@SuppressWarnings("all")
public void analyzeEntitySentimentTest() {
String language = "language-1613589672";
AnalyzeEntitySentimentResponse expectedResponse = AnalyzeEntitySentimentResponse.newBuilder().setLanguage(language).build();
mockLanguageService.addResponse(expectedResponse);
Document document = Document.newBuilder().build();
EncodingType encodingType = EncodingType.NONE;
AnalyzeEntitySentimentResponse actualResponse = client.analyzeEntitySentiment(document, encodingType);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockLanguageService.getRequests();
Assert.assertEquals(1, actualRequests.size());
AnalyzeEntitySentimentRequest actualRequest = (AnalyzeEntitySentimentRequest) actualRequests.get(0);
Assert.assertEquals(document, actualRequest.getDocument());
Assert.assertEquals(encodingType, actualRequest.getEncodingType());
}
use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class LanguageServiceClientTest method analyzeSentimentTest.
@Test
@SuppressWarnings("all")
public void analyzeSentimentTest() {
String language = "language-1613589672";
AnalyzeSentimentResponse expectedResponse = AnalyzeSentimentResponse.newBuilder().setLanguage(language).build();
mockLanguageService.addResponse(expectedResponse);
Document document = Document.newBuilder().build();
AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockLanguageService.getRequests();
Assert.assertEquals(1, actualRequests.size());
AnalyzeSentimentRequest actualRequest = (AnalyzeSentimentRequest) actualRequests.get(0);
Assert.assertEquals(document, actualRequest.getDocument());
}
use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class LanguageServiceClientTest method analyzeSentimentTest.
@Test
@SuppressWarnings("all")
public void analyzeSentimentTest() {
String language = "language-1613589672";
AnalyzeSentimentResponse expectedResponse = AnalyzeSentimentResponse.newBuilder().setLanguage(language).build();
mockLanguageService.addResponse(expectedResponse);
Document document = Document.newBuilder().build();
AnalyzeSentimentResponse actualResponse = client.analyzeSentiment(document);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockLanguageService.getRequests();
Assert.assertEquals(1, actualRequests.size());
AnalyzeSentimentRequest actualRequest = (AnalyzeSentimentRequest) actualRequests.get(0);
Assert.assertEquals(document, actualRequest.getDocument());
}
use of com.google.protobuf.GeneratedMessageV3 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());
}
use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class ErrorGroupServiceClientTest method getGroupTest.
@Test
@SuppressWarnings("all")
public void getGroupTest() {
GroupName name = GroupName.create("[PROJECT]", "[GROUP]");
String groupId = "groupId506361563";
ErrorGroup expectedResponse = ErrorGroup.newBuilder().setNameWithGroupName(name).setGroupId(groupId).build();
mockErrorGroupService.addResponse(expectedResponse);
GroupName groupName = GroupName.create("[PROJECT]", "[GROUP]");
ErrorGroup actualResponse = client.getGroup(groupName);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockErrorGroupService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetGroupRequest actualRequest = (GetGroupRequest) actualRequests.get(0);
Assert.assertEquals(groupName, actualRequest.getGroupNameAsGroupName());
}
Aggregations