use of com.google.example.library.v1.Book in project java_1_wednesday_2022 by AlexJavaGuru.
the class SearchCriteriaTest method testAuthorCriteria1.
private void testAuthorCriteria1() {
SearchCriteria searchCriteria = new AuthorSearchCriteria("1");
Book book = new Book("1", "1");
checkResult(searchCriteria.test(book));
}
use of com.google.example.library.v1.Book in project java_1_wednesday_2022 by AlexJavaGuru.
the class SearchCriteriaTest method testAndCriteria2.
private void testAndCriteria2() {
SearchCriteria searchCriteria = new AndSearchCriteria(new AuthorSearchCriteria("1"), new TitleSearchCriteria("2"));
Book book = new Book("1", "1");
checkResult(!searchCriteria.test(book));
}
use of com.google.example.library.v1.Book in project java_1_wednesday_2022 by AlexJavaGuru.
the class SearchCriteriaTest method testYearCriteria2.
private void testYearCriteria2() {
SearchCriteria searchCriteria = new YearOfIssueSearchCriteria("2000");
Book book = new Book("1", "1", "3000");
checkResult(!searchCriteria.test(book));
}
use of com.google.example.library.v1.Book in project java_1_wednesday_2022 by AlexJavaGuru.
the class SearchCriteriaTest method testAndCriteria1.
private void testAndCriteria1() {
SearchCriteria searchCriteria = new AndSearchCriteria(new AuthorSearchCriteria("1"), new TitleSearchCriteria("1"));
Book book = new Book("1", "1");
checkResult(searchCriteria.test(book));
}
use of com.google.example.library.v1.Book in project java_1_wednesday_2022 by AlexJavaGuru.
the class ContainsUIAction method execute.
@Override
public void execute() {
Scanner scanner = new Scanner(System.in);
System.out.println("Book's author: ");
String author = scanner.nextLine();
System.out.println("Book's title: ");
String title = scanner.nextLine();
scanner.close();
Book bookToCheck = new Book(author, title);
if (bookDatabase.contains(bookToCheck)) {
System.out.println("Library has this book");
} else {
System.out.println("No book found");
}
}
Aggregations