@Test public void testBookModelToJaxb() throws Exception { final MyNormalizer myNormalizer = new MyNormalizer(); final List<BookModel> books = createCsvModel(); final Bookstore result = myNormalizer.bookModelToJaxb(books); assertEquals(createJaxbModel(), result); }
public Bookstore bookModelToJaxb(List<BookModel> books) { final Bookstore bookstore = new Bookstore(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy"); for (BookModel bookModel : books) { final Book book = new Book(); final Book.Title title = new Book.Title(); book.setCategory(bookModel.getCategory()); title.setLang(bookModel.getTitleLanguage()); title.setValue(bookModel.getTitle()); book.setTitle(title); book.getAuthor().add(bookModel.getAuthor1()); final String author2 = bookModel.getAuthor2(); if ((author2 != null) && !author2.isEmpty()) { book.getAuthor().add(author2); } book.setYear(Integer.parseInt(simpleDateFormat.format(bookModel.getPublishDate()))); book.setPrice(bookModel.getPrice().doubleValue()); bookstore.getBook().add(book); } return bookstore; }
MyNormalizer { public Bookstore bookModelToJaxb(List<BookModel> books) { final Bookstore bookstore = new Bookstore(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy"); for (BookModel bookModel : books) { final Book book = new Book(); final Book.Title title = new Book.Title(); book.setCategory(bookModel.getCategory()); title.setLang(bookModel.getTitleLanguage()); title.setValue(bookModel.getTitle()); book.setTitle(title); book.getAuthor().add(bookModel.getAuthor1()); final String author2 = bookModel.getAuthor2(); if ((author2 != null) && !author2.isEmpty()) { book.getAuthor().add(author2); } book.setYear(Integer.parseInt(simpleDateFormat.format(bookModel.getPublishDate()))); book.setPrice(bookModel.getPrice().doubleValue()); bookstore.getBook().add(book); } return bookstore; } }
MyNormalizer { public Bookstore bookModelToJaxb(List<BookModel> books) { final Bookstore bookstore = new Bookstore(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy"); for (BookModel bookModel : books) { final Book book = new Book(); final Book.Title title = new Book.Title(); book.setCategory(bookModel.getCategory()); title.setLang(bookModel.getTitleLanguage()); title.setValue(bookModel.getTitle()); book.setTitle(title); book.getAuthor().add(bookModel.getAuthor1()); final String author2 = bookModel.getAuthor2(); if ((author2 != null) && !author2.isEmpty()) { book.getAuthor().add(author2); } book.setYear(Integer.parseInt(simpleDateFormat.format(bookModel.getPublishDate()))); book.setPrice(bookModel.getPrice().doubleValue()); bookstore.getBook().add(book); } return bookstore; }  }
MyNormalizer { public Bookstore bookModelToJaxb(List<BookModel> books) { final Bookstore bookstore = new Bookstore(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy"); for (BookModel bookModel : books) { final Book book = new Book(); final Book.Title title = new Book.Title(); book.setCategory(bookModel.getCategory()); title.setLang(bookModel.getTitleLanguage()); title.setValue(bookModel.getTitle()); book.setTitle(title); book.getAuthor().add(bookModel.getAuthor1()); final String author2 = bookModel.getAuthor2(); if ((author2 != null) && !author2.isEmpty()) { book.getAuthor().add(author2); } book.setYear(Integer.parseInt(simpleDateFormat.format(bookModel.getPublishDate()))); book.setPrice(bookModel.getPrice().doubleValue()); bookstore.getBook().add(book); } return bookstore; }  Bookstore bookModelToJaxb(List<BookModel> books); }
MyNormalizer { public Bookstore bookModelToJaxb(List<BookModel> books) { final Bookstore bookstore = new Bookstore(); final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy"); for (BookModel bookModel : books) { final Book book = new Book(); final Book.Title title = new Book.Title(); book.setCategory(bookModel.getCategory()); title.setLang(bookModel.getTitleLanguage()); title.setValue(bookModel.getTitle()); book.setTitle(title); book.getAuthor().add(bookModel.getAuthor1()); final String author2 = bookModel.getAuthor2(); if ((author2 != null) && !author2.isEmpty()) { book.getAuthor().add(author2); } book.setYear(Integer.parseInt(simpleDateFormat.format(bookModel.getPublishDate()))); book.setPrice(bookModel.getPrice().doubleValue()); bookstore.getBook().add(book); } return bookstore; }  Bookstore bookModelToJaxb(List<BookModel> books);  }