Search in sources :

Example 31 with Book

use of com.google.example.library.v1.Book in project java_1_wednesday_2022 by AlexJavaGuru.

the class SearchCriteriaTest method testOrCriteria2.

private void testOrCriteria2() {
    SearchCriteria searchCriteria = new OrSearchCriteria(new AuthorSearchCriteria("1"), new TitleSearchCriteria("1"));
    Book book = new Book("2", "2");
    checkResult(!searchCriteria.test(book));
}
Also used : Book(student_arturs_melnikovs.lesson_10.level_02.Book)

Example 32 with Book

use of com.google.example.library.v1.Book in project java_1_wednesday_2022 by AlexJavaGuru.

the class SaveBookUIAction method execute.

public void execute() {
    Scanner scanner = new Scanner(System.in);
    System.out.println("Book title: ");
    String title = scanner.nextLine();
    System.out.println("Book author: ");
    String author = scanner.nextLine();
    System.out.println("Year of issue: ");
    String year = scanner.nextLine();
    Book book = new Book(title, author, year);
    bookDatabase.save(book);
}
Also used : Scanner(java.util.Scanner) Book(student_arturs_melnikovs.lesson_10.level_02.Book)

Example 33 with Book

use of com.google.example.library.v1.Book in project java_1_wednesday_2022 by AlexJavaGuru.

the class Demo method something.

public static String something(String language, Function<Book, String> function) {
    String result = "";
    if (language.equals("DE")) {
        Book book = new Book("any", "any");
        result = function.apply(book);
    }
    return result;
}
Also used : Book(student_arturs_melnikovs.lesson_10.level_02.Book)

Example 34 with Book

use of com.google.example.library.v1.Book in project wicket by apache.

the class WicketTesterTest method viewBook.

/**
 * @throws Exception
 */
@Test
public void viewBook() throws Exception {
    Book mockBook = new Book("xxId", "xxName");
    Page page = new ViewBook(mockBook);
    tester.startPage(page);
    // assertion
    tester.assertRenderedPage(ViewBook.class);
    tester.assertLabel("id", "xxId");
    tester.assertLabel("name", "xxName");
}
Also used : CreateBook(org.apache.wicket.util.tester.apps_1.CreateBook) ViewBook(org.apache.wicket.util.tester.apps_1.ViewBook) Book(org.apache.wicket.util.tester.apps_1.Book) ViewBook(org.apache.wicket.util.tester.apps_1.ViewBook) Page(org.apache.wicket.Page) ComponentFeedbackResourceTestingPage(org.apache.wicket.util.tester.apps_8.ComponentFeedbackResourceTestingPage) DummyPage(org.apache.wicket.resource.DummyPage) SuccessPage(org.apache.wicket.util.tester.apps_1.SuccessPage) ResultPage(org.apache.wicket.util.tester.apps_6.ResultPage) LinkPage(org.apache.wicket.util.tester.apps_6.LinkPage) MockInnerClassPage(org.apache.wicket.util.tester.MockPageParameterPage.MockInnerClassPage) AccessDeniedPage(org.apache.wicket.markup.html.pages.AccessDeniedPage) WebPage(org.apache.wicket.markup.html.WebPage) Test(org.junit.Test)

Example 35 with Book

use of com.google.example.library.v1.Book in project wicket by apache.

the class WicketTesterTest method pageConstructor.

/**
 * @throws Exception
 */
@Test
public void pageConstructor() throws Exception {
    Book mockBook = new Book("xxId", "xxName");
    Page page = new ViewBook(mockBook);
    tester.startPage(page);
    // assertion
    tester.assertRenderedPage(ViewBook.class);
    tester.clickLink("link");
    tester.assertRenderedPage(CreateBook.class);
}
Also used : CreateBook(org.apache.wicket.util.tester.apps_1.CreateBook) ViewBook(org.apache.wicket.util.tester.apps_1.ViewBook) Book(org.apache.wicket.util.tester.apps_1.Book) ViewBook(org.apache.wicket.util.tester.apps_1.ViewBook) Page(org.apache.wicket.Page) ComponentFeedbackResourceTestingPage(org.apache.wicket.util.tester.apps_8.ComponentFeedbackResourceTestingPage) DummyPage(org.apache.wicket.resource.DummyPage) SuccessPage(org.apache.wicket.util.tester.apps_1.SuccessPage) ResultPage(org.apache.wicket.util.tester.apps_6.ResultPage) LinkPage(org.apache.wicket.util.tester.apps_6.LinkPage) MockInnerClassPage(org.apache.wicket.util.tester.MockPageParameterPage.MockInnerClassPage) AccessDeniedPage(org.apache.wicket.markup.html.pages.AccessDeniedPage) WebPage(org.apache.wicket.markup.html.WebPage) Test(org.junit.Test)

Aggregations

Book (com.google.example.library.v1.Book)33 Test (org.junit.Test)25 LibraryServiceClient (com.google.cloud.example.library.v1.LibraryServiceClient)22 Book (student_arturs_melnikovs.lesson_10.level_02.Book)16 BookName (com.google.example.library.v1.BookName)12 AbstractMessage (com.google.protobuf.AbstractMessage)12 ShelfName (com.google.example.library.v1.ShelfName)9 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)7 StatusRuntimeException (io.grpc.StatusRuntimeException)7 MoveBookRequest (com.google.example.library.v1.MoveBookRequest)6 DeleteBookRequest (com.google.example.library.v1.DeleteBookRequest)5 Scanner (java.util.Scanner)5 CreateBookRequest (com.google.example.library.v1.CreateBookRequest)4 GetBookRequest (com.google.example.library.v1.GetBookRequest)4 Page (org.apache.wicket.Page)4 Book (org.apache.wicket.core.util.tester.apps_1.Book)4 WebPage (org.apache.wicket.markup.html.WebPage)4 AccessDeniedPage (org.apache.wicket.markup.html.pages.AccessDeniedPage)4 DummyPage (org.apache.wicket.resource.DummyPage)4 Book (org.apache.wicket.util.tester.apps_1.Book)4