Search in sources :

Example 21 with Book

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

the class WicketTesterTest method bookmarkableLink.

/**
 * @throws Exception
 */
@Test
void bookmarkableLink() throws Exception {
    // for WebPage without default constructor, I define a TestPageSource to
    // let the page be instatiated lately.
    Book mockBook = new Book("xxId", "xxName");
    tester.startPage(new ViewBook(mockBook));
    // assertion
    tester.assertRenderedPage(ViewBook.class);
    tester.clickLink("link");
    tester.assertRenderedPage(CreateBook.class);
}
Also used : Book(org.apache.wicket.core.util.tester.apps_1.Book) CreateBook(org.apache.wicket.core.util.tester.apps_1.CreateBook) ViewBook(org.apache.wicket.core.util.tester.apps_1.ViewBook) ViewBook(org.apache.wicket.core.util.tester.apps_1.ViewBook) Test(org.junit.jupiter.api.Test)

Example 22 with Book

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

the class FormTesterTest method before.

/**
 */
@BeforeEach
void before() {
    books = new Book[] { new Book("1", "book1"), new Book("2", "book2"), new Book("3", "book3"), new Book("4", "book4") };
    choicePage = tester.startPage(new ChoicePage(Arrays.asList(books)));
    formTester = tester.newFormTester("choiceForm");
}
Also used : Book(org.apache.wicket.core.util.tester.apps_1.Book) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 23 with Book

use of com.google.example.library.v1.Book in project java_1_sunday_january_2022_online by javagurulv.

the class ArrayOutOfBoundExceptionException method m3.

public static void m3() {
    Book book = new Book();
    System.out.println("M3");
// ArrayOutOfBoundExceptionExceptionV2.m3();
}
Also used : Book(student_alina_strumpe._lesson_2_level_2_intern_Task_3.Book)

Example 24 with Book

use of com.google.example.library.v1.Book in project java_1_sunday_january_2022_online by javagurulv.

the class ListExample method main.

public static void main(String[] args) {
    int[] objects = new int[10];
    // List<int>
    // int, long, double, float, boolean
    Integer numberI = Integer.parseInt("3");
    Long nuberL = Long.parseLong("3");
    List<Integer> numbers = new ArrayList<>();
    List<Integer> numbersv2 = new LinkedList<>();
    System.out.println("List length = " + numbers.size());
    System.out.println("List isEmpty = " + numbers.isEmpty());
    numbers.add(Integer.parseInt("4"));
    numbers.add(3);
    numbers.add(4);
    // -> numbers.add(new Integer(5))
    numbers.add(5);
    numbers.add(6);
    numbers.add(0, 777);
    // /numbers.add(3L);
    System.out.println("List length = " + numbers.size());
    System.out.println("List isEmpty = " + numbers.isEmpty());
    numbers.add(777);
    numbers.add(777);
    numbers.add(777);
    for (int i = 0; i < numbers.size(); i++) {
        Integer number = numbers.get(i);
        System.out.println("Index = " + i + " Element = " + number);
    }
    for (Integer number : numbers) {
        System.out.println("Element for each = " + number);
    }
    numbers.forEach(System.out::println);
    numbers.remove(0);
    numbers.remove(Integer.parseInt("5"));
    List<Integer> numbersToRemove = new ArrayList<>();
    numbersToRemove.add(Integer.parseInt("777"));
    numbers.removeAll(numbersToRemove);
    System.out.println("After remove:");
    numbers.forEach(System.out::println);
    List<String> words = new LinkedList<>();
    boolean contains3 = numbers.contains(3);
    System.out.println("Contains 3 = " + contains3);
    List<Book> books = new ArrayList<>();
    Book book1 = new Book();
    Book book2 = new Book();
    Book book3 = new Book();
    books.add(book1);
    books.add(book2);
    books.add(book3);
}
Also used : ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) Book(student_alina_strumpe._lesson_2_level_2_intern_Task_3.Book)

Example 25 with Book

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

the class FindByAuthorUIAction method execute.

@Override
public void execute() {
    Scanner scanner = new Scanner(System.in);
    System.out.println("Author's name: ");
    String authorName = scanner.nextLine();
    List<Book> books = bookDatabase.findByAuthor(authorName);
    System.out.println(books);
}
Also used : Scanner(java.util.Scanner) Book(student_arturs_melnikovs.lesson_10.level_02.Book)

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