use of com.google.example.library.v1.ShelfName in project gapic-generator-java by googleapis.
the class LibraryServiceClientTest method mergeShelvesTest.
@Test
public void mergeShelvesTest() throws Exception {
Shelf expectedResponse = Shelf.newBuilder().setName(ShelfName.of("[SHELF_ID]").toString()).setTheme("theme110327241").build();
mockLibraryService.addResponse(expectedResponse);
ShelfName name = ShelfName.of("[SHELF_ID]");
ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
Shelf actualResponse = client.mergeShelves(name, otherShelf);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockLibraryService.getRequests();
Assert.assertEquals(1, actualRequests.size());
MergeShelvesRequest actualRequest = ((MergeShelvesRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertEquals(otherShelf.toString(), actualRequest.getOtherShelf());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.example.library.v1.ShelfName in project gapic-generator-java by googleapis.
the class LibraryServiceClientTest method mergeShelvesExceptionTest3.
@Test
public void mergeShelvesExceptionTest3() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockLibraryService.addException(exception);
try {
String name = "name3373707";
ShelfName otherShelf = ShelfName.of("[SHELF_ID]");
client.mergeShelves(name, otherShelf);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.example.library.v1.ShelfName in project gapic-generator-java by googleapis.
the class LibraryServiceClientTest method getShelfExceptionTest.
@Test
public void getShelfExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockLibraryService.addException(exception);
try {
ShelfName name = ShelfName.of("[SHELF_ID]");
client.getShelf(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.example.library.v1.ShelfName in project gapic-generator-java by googleapis.
the class LibraryServiceClientTest method mergeShelvesExceptionTest2.
@Test
public void mergeShelvesExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockLibraryService.addException(exception);
try {
ShelfName name = ShelfName.of("[SHELF_ID]");
String otherShelf = "otherShelf-193668870";
client.mergeShelves(name, otherShelf);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.example.library.v1.ShelfName in project gapic-generator-java by googleapis.
the class LibraryServiceClientTest method moveBookTest3.
@Test
public void moveBookTest3() throws Exception {
Book expectedResponse = Book.newBuilder().setName(BookName.of("[SHELF]", "[BOOK]").toString()).setAuthor("author-1406328437").setTitle("title110371416").setRead(true).build();
mockLibraryService.addResponse(expectedResponse);
String name = "name3373707";
ShelfName otherShelfName = ShelfName.of("[SHELF_ID]");
Book actualResponse = client.moveBook(name, otherShelfName);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockLibraryService.getRequests();
Assert.assertEquals(1, actualRequests.size());
MoveBookRequest actualRequest = ((MoveBookRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertEquals(otherShelfName.toString(), actualRequest.getOtherShelfName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations