use of com.google.example.library.v1.GetShelfRequest in project gapic-generator-java by googleapis.
the class LibraryServiceClientTest method getShelfTest2.
@Test
public void getShelfTest2() throws Exception {
Shelf expectedResponse = Shelf.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).setTheme("theme110327241").build();
mockLibraryService.addResponse(expectedResponse);
String name = "name3373707";
Shelf actualResponse = client.getShelf(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockLibraryService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetShelfRequest actualRequest = ((GetShelfRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.example.library.v1.GetShelfRequest in project gapic-generator-java by googleapis.
the class AsyncGetShelf method asyncGetShelf.
public static void asyncGetShelf() throws Exception {
// It may require modifications to work in your environment.
try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
GetShelfRequest request = GetShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
ApiFuture<Shelf> future = libraryServiceClient.getShelfCallable().futureCall(request);
// Do something.
Shelf response = future.get();
}
}
use of com.google.example.library.v1.GetShelfRequest in project gapic-generator-java by googleapis.
the class SyncGetShelf method syncGetShelf.
public static void syncGetShelf() throws Exception {
// It may require modifications to work in your environment.
try (LibraryServiceClient libraryServiceClient = LibraryServiceClient.create()) {
GetShelfRequest request = GetShelfRequest.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).build();
Shelf response = libraryServiceClient.getShelf(request);
}
}
use of com.google.example.library.v1.GetShelfRequest in project gapic-generator-java by googleapis.
the class LibraryServiceClientTest method getShelfTest.
@Test
public void getShelfTest() throws Exception {
Shelf expectedResponse = Shelf.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).setTheme("theme110327241").build();
mockLibraryService.addResponse(expectedResponse);
ShelfName name = ShelfName.of("[SHELF_ID]");
Shelf actualResponse = client.getShelf(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockLibraryService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetShelfRequest actualRequest = ((GetShelfRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations