From 23191300439ca96653e07f184bbe9e9c88212100 Mon Sep 17 00:00:00 2001 From: Justin Albano Date: Thu, 14 Nov 2019 10:05:44 -0500 Subject: [PATCH 1/6] BAEL-3444: Added Cucumber data table test cases. --- testing-modules/testing-libraries/pom.xml | 13 ++-- .../com/baeldung/cucumber/books/Book.java | 35 +++++++++++ .../baeldung/cucumber/books/BookCatalog.java | 22 +++++++ .../baeldung/cucumber/books/BookStore.java | 26 ++++++++ .../calculator/CalculatorIntegrationTest.java | 5 +- .../calculator/CalculatorRunSteps.java | 12 ++-- .../books/BookStoreIntegrationTest.java | 14 +++++ .../books/BookStoreRegistryConfigurer.java | 44 ++++++++++++++ .../cucumber/books/BookStoreRunSteps.java | 60 +++++++++++++++++++ .../shopping/ShoppingIntegrationTest.java | 5 +- .../baeldung/shopping/ShoppingStepsDef.java | 3 +- .../resources/features/book-store.feature | 33 ++++++++++ 12 files changed, 256 insertions(+), 16 deletions(-) create mode 100644 testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/Book.java create mode 100644 testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookCatalog.java create mode 100644 testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookStore.java create mode 100644 testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreIntegrationTest.java create mode 100644 testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java create mode 100644 testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java create mode 100644 testing-modules/testing-libraries/src/test/resources/features/book-store.feature diff --git a/testing-modules/testing-libraries/pom.xml b/testing-modules/testing-libraries/pom.xml index 0838e81d14..521520833d 100644 --- a/testing-modules/testing-libraries/pom.xml +++ b/testing-modules/testing-libraries/pom.xml @@ -18,21 +18,22 @@ ${lambda-behave.version} - info.cukes + io.cucumber cucumber-junit - ${cucumber.version} + 4.8.0 test - info.cukes + io.cucumber cucumber-java - ${cucumber.version} + 4.8.0 test + - info.cukes + io.cucumber cucumber-java8 - ${cucumber.version} + 4.8.0 test diff --git a/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/Book.java b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/Book.java new file mode 100644 index 0000000000..f83623445b --- /dev/null +++ b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/Book.java @@ -0,0 +1,35 @@ +package com.baeldung.cucumber.books; + +public class Book { + + private String title; + private String author; + + public Book(String title, String author) { + this.title = title; + this.author = author; + } + + public Book() {} + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + @Override + public String toString() { + return "Book [title=" + title + ", author=" + author + "]"; + } +} diff --git a/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookCatalog.java b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookCatalog.java new file mode 100644 index 0000000000..69fa8e3160 --- /dev/null +++ b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookCatalog.java @@ -0,0 +1,22 @@ +package com.baeldung.cucumber.books; + +import java.util.ArrayList; +import java.util.List; + +public class BookCatalog { + + private List books = new ArrayList<>(); + + public void addBook(Book book) { + books.add(book); + } + + public List getBooks() { + return books; + } + + @Override + public String toString() { + return "BookCatalog [books=" + books + "]"; + } +} diff --git a/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookStore.java b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookStore.java new file mode 100644 index 0000000000..e5a3ceab3e --- /dev/null +++ b/testing-modules/testing-libraries/src/main/java/com/baeldung/cucumber/books/BookStore.java @@ -0,0 +1,26 @@ +package com.baeldung.cucumber.books; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +public class BookStore { + + private List books = new ArrayList<>(); + + public void addBook(Book book) { + books.add(book); + } + + public void addAllBooks(Collection books) { + this.books.addAll(books); + } + + public List booksByAuthor(String author) { + return books.stream() + .filter(book -> Objects.equals(author, book.getAuthor())) + .collect(Collectors.toList()); + } +} diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorIntegrationTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorIntegrationTest.java index 00f666db2d..e4580900a2 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorIntegrationTest.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorIntegrationTest.java @@ -1,9 +1,10 @@ package com.baeldung.calculator; -import cucumber.api.CucumberOptions; -import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; +import io.cucumber.junit.Cucumber; +import io.cucumber.junit.CucumberOptions; + @RunWith(Cucumber.class) @CucumberOptions( features = {"classpath:features/calculator.feature", "classpath:features/calculator-scenario-outline.feature"} diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorRunSteps.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorRunSteps.java index 7eda618566..1bf0c0eccd 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorRunSteps.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/calculator/CalculatorRunSteps.java @@ -1,13 +1,15 @@ package com.baeldung.calculator; -import com.baeldung.cucumber.Calculator; -import cucumber.api.java.Before; -import cucumber.api.java.en.Given; -import cucumber.api.java.en.Then; -import cucumber.api.java.en.When; import org.hamcrest.Matchers; import org.junit.Assert; +import com.baeldung.cucumber.Calculator; + +import io.cucumber.java.Before; +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; + public class CalculatorRunSteps { private int total; diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreIntegrationTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreIntegrationTest.java new file mode 100644 index 0000000000..233fd3c489 --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreIntegrationTest.java @@ -0,0 +1,14 @@ +package com.baeldung.cucumber.books; + +import org.junit.runner.RunWith; + +import io.cucumber.junit.Cucumber; +import io.cucumber.junit.CucumberOptions; + + +@RunWith(Cucumber.class) +@CucumberOptions(features = "classpath:features/book-store.feature") +public class BookStoreIntegrationTest { + +} + diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java new file mode 100644 index 0000000000..e8e7e91994 --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java @@ -0,0 +1,44 @@ +package com.baeldung.cucumber.books; + +import java.util.Locale; + +import io.cucumber.core.api.TypeRegistry; +import io.cucumber.core.api.TypeRegistryConfigurer; +import io.cucumber.datatable.DataTable; +import io.cucumber.datatable.DataTableType; +import io.cucumber.datatable.TableTransformer; + +public class BookStoreRegistryConfigurer implements TypeRegistryConfigurer { + + @Override + public Locale locale() { + return Locale.ENGLISH; + } + + @Override + public void configureTypeRegistry(TypeRegistry typeRegistry) { + typeRegistry.defineDataTableType(new DataTableType(BookCatalog.class, new BookTableTransformer())); + + } + + private static class BookTableTransformer implements TableTransformer { + + @Override + public BookCatalog transform(DataTable table) throws Throwable { + + BookCatalog catalog = new BookCatalog(); + + table.cells() + .stream() + .skip(1) // Skip header row + .map(fields -> new Book(fields.get(0), fields.get(1))) + .forEach(catalog::addBook); + + System.out.println(catalog); + + return catalog; + } + + } + +} diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java new file mode 100644 index 0000000000..21901d913d --- /dev/null +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java @@ -0,0 +1,60 @@ +package com.baeldung.cucumber.books; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import io.cucumber.java.Before; +import io.cucumber.java.en.Given; +import io.cucumber.java.en.Then; +import io.cucumber.java.en.When; +import io.cucumber.datatable.DataTable; + +public class BookStoreRunSteps { + + private BookStore store; + private List foundBooks; + + @Before + public void setUp() { + store = new BookStore(); + foundBooks = new ArrayList<>(); + } + + @Given("^I have the following books in the store by list$") + public void haveBooksInTheStoreByList(DataTable table) { + + List> rows = table.asLists(String.class); + + for (List fields: rows) { + store.addBook(new Book(fields.get(0), fields.get(1))); + } + } + + @Given("^I have the following books in the store by map$") + public void haveBooksInTheStoreByMap(DataTable table) { + + List> rows = table.asMaps(String.class, String.class); + + for (Map fields: rows) { + store.addBook(new Book(fields.get("title"), fields.get("author"))); + } + } + + @Given("^I have the following books in the store with custom table parsing$") + public void haveBooksInTheStoreByListOfDomainObjects(BookCatalog catalog) { + store.addAllBooks(catalog.getBooks()); + } + + @When("^I search for books by author (.+)$") + public void searchForBooksByAuthor(String author) { + foundBooks = store.booksByAuthor(author); + } + + @Then("^I find (\\d+) books$") + public void findBooks(int count) { + assertEquals(count, foundBooks.size()); + } +} diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingIntegrationTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingIntegrationTest.java index 20fd65b02a..145b29a468 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingIntegrationTest.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingIntegrationTest.java @@ -2,8 +2,9 @@ package com.baeldung.shopping; import org.junit.runner.RunWith; -import cucumber.api.CucumberOptions; -import cucumber.api.junit.Cucumber; +import io.cucumber.junit.Cucumber; +import io.cucumber.junit.CucumberOptions; + @RunWith(Cucumber.class) @CucumberOptions(features = { "classpath:features/shopping.feature" }) diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingStepsDef.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingStepsDef.java index c56ec95883..7a70eea951 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingStepsDef.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/shopping/ShoppingStepsDef.java @@ -1,7 +1,8 @@ package com.baeldung.shopping; import static org.junit.Assert.assertEquals; -import cucumber.api.java8.En; + +import io.cucumber.java8.En; public class ShoppingStepsDef implements En { diff --git a/testing-modules/testing-libraries/src/test/resources/features/book-store.feature b/testing-modules/testing-libraries/src/test/resources/features/book-store.feature new file mode 100644 index 0000000000..6b416508dc --- /dev/null +++ b/testing-modules/testing-libraries/src/test/resources/features/book-store.feature @@ -0,0 +1,33 @@ +Feature: Book Store + + Scenario: Correct non-zero number of books found by author by list + Given I have the following books in the store by list + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + | Jane Eyre | Charlotte Bronte | + | Frankenstein | Mary Shelley | + When I search for books by author Erik Larson + Then I find 2 books + + Scenario: Correct non-zero number of books found by author by map + Given I have the following books in the store by map + | title | author | + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + | Jane Eyre | Charlotte Bronte | + | Frankenstein | Mary Shelley | + When I search for books by author Erik Larson + Then I find 2 books + + Scenario: Correct non-zero number of books found by author with custom table parsing + Given I have the following books in the store with custom table parsing + | title | author | + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + | Jane Eyre | Charlotte Bronte | + | Frankenstein | Mary Shelley | + When I search for books by author Erik Larson + Then I find 2 books \ No newline at end of file From b51f276b2c90bbed48beffde0fda92d18d589972 Mon Sep 17 00:00:00 2001 From: Justin Albano Date: Thu, 14 Nov 2019 15:12:35 -0500 Subject: [PATCH 2/6] BAEL-3444: Renamed parsing logic variables for improved clarity in the context of article. --- .../com/baeldung/cucumber/books/BookStoreRunSteps.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java index 21901d913d..f87bac682f 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java @@ -28,8 +28,8 @@ public class BookStoreRunSteps { List> rows = table.asLists(String.class); - for (List fields: rows) { - store.addBook(new Book(fields.get(0), fields.get(1))); + for (List columns: rows) { + store.addBook(new Book(columns.get(0), columns.get(1))); } } @@ -38,8 +38,8 @@ public class BookStoreRunSteps { List> rows = table.asMaps(String.class, String.class); - for (Map fields: rows) { - store.addBook(new Book(fields.get("title"), fields.get("author"))); + for (Map columns: rows) { + store.addBook(new Book(columns.get("title"), columns.get("author"))); } } From 423a529f56a9fe3f343b0b92782dc215d1bd9551 Mon Sep 17 00:00:00 2001 From: Justin Albano Date: Thu, 14 Nov 2019 20:50:45 -0500 Subject: [PATCH 3/6] BAEL-3444: Simplified example steps --- .../books/BookStoreIntegrationTest.java | 1 - .../books/BookStoreRegistryConfigurer.java | 4 -- .../cucumber/books/BookStoreRunSteps.java | 4 +- .../resources/features/book-store.feature | 52 ++++++++----------- 4 files changed, 25 insertions(+), 36 deletions(-) diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreIntegrationTest.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreIntegrationTest.java index 233fd3c489..5ed2700af8 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreIntegrationTest.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreIntegrationTest.java @@ -5,7 +5,6 @@ import org.junit.runner.RunWith; import io.cucumber.junit.Cucumber; import io.cucumber.junit.CucumberOptions; - @RunWith(Cucumber.class) @CucumberOptions(features = "classpath:features/book-store.feature") public class BookStoreIntegrationTest { diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java index e8e7e91994..d76cfcbfd3 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java @@ -18,7 +18,6 @@ public class BookStoreRegistryConfigurer implements TypeRegistryConfigurer { @Override public void configureTypeRegistry(TypeRegistry typeRegistry) { typeRegistry.defineDataTableType(new DataTableType(BookCatalog.class, new BookTableTransformer())); - } private static class BookTableTransformer implements TableTransformer { @@ -34,11 +33,8 @@ public class BookStoreRegistryConfigurer implements TypeRegistryConfigurer { .map(fields -> new Book(fields.get(0), fields.get(1))) .forEach(catalog::addBook); - System.out.println(catalog); - return catalog; } } - } diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java index f87bac682f..2af94e5b42 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java @@ -43,8 +43,8 @@ public class BookStoreRunSteps { } } - @Given("^I have the following books in the store with custom table parsing$") - public void haveBooksInTheStoreByListOfDomainObjects(BookCatalog catalog) { + @Given("^I have the following books in the store with transformer$") + public void haveBooksInTheStoreByListOfTransformer(BookCatalog catalog) { store.addAllBooks(catalog.getBooks()); } diff --git a/testing-modules/testing-libraries/src/test/resources/features/book-store.feature b/testing-modules/testing-libraries/src/test/resources/features/book-store.feature index 6b416508dc..6378477349 100644 --- a/testing-modules/testing-libraries/src/test/resources/features/book-store.feature +++ b/testing-modules/testing-libraries/src/test/resources/features/book-store.feature @@ -1,33 +1,27 @@ Feature: Book Store Scenario: Correct non-zero number of books found by author by list - Given I have the following books in the store by list - | The Devil in the White City | Erik Larson | - | The Lion, the Witch and the Wardrobe | C.S. Lewis | - | In the Garden of Beasts | Erik Larson | - | Jane Eyre | Charlotte Bronte | - | Frankenstein | Mary Shelley | - When I search for books by author Erik Larson - Then I find 2 books - + Given I have the following books in the store by list + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + When I search for books by author Erik Larson + Then I find 2 books + Scenario: Correct non-zero number of books found by author by map - Given I have the following books in the store by map - | title | author | - | The Devil in the White City | Erik Larson | - | The Lion, the Witch and the Wardrobe | C.S. Lewis | - | In the Garden of Beasts | Erik Larson | - | Jane Eyre | Charlotte Bronte | - | Frankenstein | Mary Shelley | - When I search for books by author Erik Larson - Then I find 2 books - - Scenario: Correct non-zero number of books found by author with custom table parsing - Given I have the following books in the store with custom table parsing - | title | author | - | The Devil in the White City | Erik Larson | - | The Lion, the Witch and the Wardrobe | C.S. Lewis | - | In the Garden of Beasts | Erik Larson | - | Jane Eyre | Charlotte Bronte | - | Frankenstein | Mary Shelley | - When I search for books by author Erik Larson - Then I find 2 books \ No newline at end of file + Given I have the following books in the store by map + | title | author | + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + When I search for books by author Erik Larson + Then I find 2 books + + Scenario: Correct non-zero number of books found by author with transformer + Given I have the following books in the store with transformer + | title | author | + | The Devil in the White City | Erik Larson | + | The Lion, the Witch and the Wardrobe | C.S. Lewis | + | In the Garden of Beasts | Erik Larson | + When I search for books by author Erik Larson + Then I find 2 books \ No newline at end of file From 530507243a84c7186fae66dab8610c336604f50a Mon Sep 17 00:00:00 2001 From: Justin Albano Date: Fri, 15 Nov 2019 10:24:27 -0500 Subject: [PATCH 4/6] BAEL-3444: Corrected typo of test method name --- .../java/com/baeldung/cucumber/books/BookStoreRunSteps.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java index 2af94e5b42..e0944d3dd4 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRunSteps.java @@ -44,7 +44,7 @@ public class BookStoreRunSteps { } @Given("^I have the following books in the store with transformer$") - public void haveBooksInTheStoreByListOfTransformer(BookCatalog catalog) { + public void haveBooksInTheStoreByTransformer(BookCatalog catalog) { store.addAllBooks(catalog.getBooks()); } From 4910f5879a227312b1f062bed2b45874867aa413 Mon Sep 17 00:00:00 2001 From: Justin Albano Date: Fri, 15 Nov 2019 10:50:33 -0500 Subject: [PATCH 5/6] BAEL-3444: Updated Maven Cucumber version --- testing-modules/testing-libraries/pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/testing-modules/testing-libraries/pom.xml b/testing-modules/testing-libraries/pom.xml index 521520833d..844fcb3e53 100644 --- a/testing-modules/testing-libraries/pom.xml +++ b/testing-modules/testing-libraries/pom.xml @@ -20,20 +20,20 @@ io.cucumber cucumber-junit - 4.8.0 + ${cucumber.version} test io.cucumber cucumber-java - 4.8.0 + ${cucumber.version} test io.cucumber cucumber-java8 - 4.8.0 + ${cucumber.version} test @@ -88,7 +88,7 @@ 0.4 - 1.2.5 + 4.8.0 3.0.0 From 03a1413465d47400ecb2ce580dba5e3e7908d8b8 Mon Sep 17 00:00:00 2001 From: Justin Albano Date: Tue, 19 Nov 2019 09:11:25 -0500 Subject: [PATCH 6/6] BAEL-3444: Corrected line continuation formatting --- .../cucumber/books/BookStoreRegistryConfigurer.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java index d76cfcbfd3..12de1ae71e 100644 --- a/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java +++ b/testing-modules/testing-libraries/src/test/java/com/baeldung/cucumber/books/BookStoreRegistryConfigurer.java @@ -17,7 +17,9 @@ public class BookStoreRegistryConfigurer implements TypeRegistryConfigurer { @Override public void configureTypeRegistry(TypeRegistry typeRegistry) { - typeRegistry.defineDataTableType(new DataTableType(BookCatalog.class, new BookTableTransformer())); + typeRegistry.defineDataTableType( + new DataTableType(BookCatalog.class, new BookTableTransformer()) + ); } private static class BookTableTransformer implements TableTransformer { @@ -28,10 +30,10 @@ public class BookStoreRegistryConfigurer implements TypeRegistryConfigurer { BookCatalog catalog = new BookCatalog(); table.cells() - .stream() - .skip(1) // Skip header row - .map(fields -> new Book(fields.get(0), fields.get(1))) - .forEach(catalog::addBook); + .stream() + .skip(1) // Skip header row + .map(fields -> new Book(fields.get(0), fields.get(1))) + .forEach(catalog::addBook); return catalog; }