From a6228f0769d3ec96b8683af7709edf365921a1b8 Mon Sep 17 00:00:00 2001 From: Bertil Muth Date: Thu, 16 May 2019 23:29:45 +0200 Subject: [PATCH] Remove hexagon example (as it's in its own GitHub repository now) --- requirementsascodeexamples/hexagon/README.md | 6 -- .../hexagon/build.gradle | 12 ---- .../java/poem/hexagon/boundary/Boundary.java | 52 ---------------- .../poem/hexagon/boundary/UseCaseModel.java | 30 ---------- .../hexagon/boundary/command/AskForPoem.java | 23 ------- .../boundary/drivenport/IObtainPoems.java | 15 ----- .../boundary/drivenport/IWriteLines.java | 15 ----- .../boundary/driverport/IReactToCommands.java | 5 -- .../commandhandler/DisplayRandomPoem.java | 60 ------------------- .../poem/hexagon/internal/domain/Poem.java | 58 ------------------ .../internal/domain/RandomPoemPicker.java | 41 ------------- .../src/main/java/poem/simple/Main.java | 33 ---------- .../simple/drivenadapter/ConsoleWriter.java | 23 ------- .../simple/drivenadapter/PoetryLibrary.java | 29 --------- .../poem/simple/driveradapter/Driver.java | 29 --------- .../internal/domain/RandomPoemPickerTest.java | 53 ---------------- settings.gradle | 1 - 17 files changed, 485 deletions(-) delete mode 100644 requirementsascodeexamples/hexagon/README.md delete mode 100644 requirementsascodeexamples/hexagon/build.gradle delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/Boundary.java delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/UseCaseModel.java delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/command/AskForPoem.java delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/drivenport/IObtainPoems.java delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/drivenport/IWriteLines.java delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/driverport/IReactToCommands.java delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/internal/commandhandler/DisplayRandomPoem.java delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/internal/domain/Poem.java delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/internal/domain/RandomPoemPicker.java delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/simple/Main.java delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/simple/drivenadapter/ConsoleWriter.java delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/simple/drivenadapter/PoetryLibrary.java delete mode 100644 requirementsascodeexamples/hexagon/src/main/java/poem/simple/driveradapter/Driver.java delete mode 100644 requirementsascodeexamples/hexagon/src/test/java/poem/hexagon/internal/domain/RandomPoemPickerTest.java diff --git a/requirementsascodeexamples/hexagon/README.md b/requirementsascodeexamples/hexagon/README.md deleted file mode 100644 index 73d437d9..00000000 --- a/requirementsascodeexamples/hexagon/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# introduction -A simple example for a hexagonal architecture, using requirements as code. -It contains a use case model and command handlers that control the flow of the application. -Check out the class comments for details. - - This example is inspired by a [talk](https://www.youtube.com/watch?v=th4AgBcrEHA) by A. Cockburn and T. Pierrain on hexagonal architecture. diff --git a/requirementsascodeexamples/hexagon/build.gradle b/requirementsascodeexamples/hexagon/build.gradle deleted file mode 100644 index 9edf37a2..00000000 --- a/requirementsascodeexamples/hexagon/build.gradle +++ /dev/null @@ -1,12 +0,0 @@ -jar { - manifest { - attributes 'Implementation-Title': 'requirements as code - hexagonal architecture', - 'Implementation-Version': version - } -} - -dependencies { - compile project(':requirementsascodecore') - testCompile 'junit:junit:4.12' -} - diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/Boundary.java b/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/Boundary.java deleted file mode 100644 index b3069fcc..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/Boundary.java +++ /dev/null @@ -1,52 +0,0 @@ -package poem.hexagon.boundary; - -import org.requirementsascode.Model; -import org.requirementsascode.ModelRunner; - -import poem.hexagon.boundary.drivenport.IObtainPoems; -import poem.hexagon.boundary.drivenport.IWriteLines; -import poem.hexagon.boundary.driverport.IReactToCommands; -import poem.hexagon.internal.commandhandler.DisplayRandomPoem; - -/** - * The boundary class is the only point of communication with left-side driver - * adapters. It accepts commands, and calls the appropriate command handler. - * - * On creation, this class wires up the dependencies between command types and - * command handlers, by injecting the command handlers into a use case model. - * - * After creation, this class sends each command it receives to the runner - * of the use case model. The model runner then dispatches the command to the - * appropriate command handler, which in turn calls the driven adapters. - * - * Inspired by a talk by A. Cockburn and T. Pierrain on hexagonal architecture: - * https://www.youtube.com/watch?v=th4AgBcrEHA - * - * @author b_muth - * - */ -public class Boundary implements IReactToCommands { - - private ModelRunner modelRunner; - - public Boundary(IObtainPoems poemObtainer, IWriteLines lineWriter) { - // Create a use case model - Model model = buildModel(poemObtainer, lineWriter); - - // Run the use case model - modelRunner = new ModelRunner().run(model); - } - - private Model buildModel(IObtainPoems poemObtainer, IWriteLines lineWriter) { - // Create the command handler(s) - DisplayRandomPoem displayRandomPoem = new DisplayRandomPoem(poemObtainer, lineWriter); - - // Inject command handler(s) into use case model, to wire them up with command types. - Model model = UseCaseModel.build(displayRandomPoem); - return model; - } - - public void reactTo(Object commandObject) { - modelRunner.reactTo(commandObject); - } -} \ No newline at end of file diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/UseCaseModel.java b/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/UseCaseModel.java deleted file mode 100644 index 3b3756ba..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/UseCaseModel.java +++ /dev/null @@ -1,30 +0,0 @@ -package poem.hexagon.boundary; - -import java.util.function.Consumer; - -import org.requirementsascode.Model; - -import poem.hexagon.boundary.command.AskForPoem; - -/** - * The use case model ties each type of command to its appropriate command - * handler interface. - * - * In business terms, this example model means: - * - * The user asks for a poem. The system displays a random poem. - * - * @author b_muth - * - */ -class UseCaseModel { - private static final Class asksForPoem = AskForPoem.class; - - public static Model build(Consumer displaysRandomPoem) { - Model model = Model.builder() - .user(asksForPoem).system(displaysRandomPoem) - .build(); - - return model; - } -} diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/command/AskForPoem.java b/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/command/AskForPoem.java deleted file mode 100644 index 84446d38..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/command/AskForPoem.java +++ /dev/null @@ -1,23 +0,0 @@ -package poem.hexagon.boundary.command; - -/** - * Command object representing the user request for a poem in a certain - * language. Supported languages are: "de" for German, "en" for English. - * - * Inspired by a talk by A. Cockburn and T. Pierrain on hexagonal architecture: - * https://www.youtube.com/watch?v=th4AgBcrEHA - * - * @author b_muth - * - */ -public class AskForPoem { - private String language; - - public AskForPoem(String language) { - this.language = language; - } - - public String getLanguage() { - return language; - } -} diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/drivenport/IObtainPoems.java b/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/drivenport/IObtainPoems.java deleted file mode 100644 index c6d5e4e0..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/drivenport/IObtainPoems.java +++ /dev/null @@ -1,15 +0,0 @@ -package poem.hexagon.boundary.drivenport; - -/** - * Driven, right side port for obtaining poems, e.g. from a repository outside - * the hexagon. - * - * Inspired by a talk by A. Cockburn and T. Pierrain on hexagonal architecture: - * https://www.youtube.com/watch?v=th4AgBcrEHA - * - * @author b_muth - * - */ -public interface IObtainPoems { - String[] getMePoems(String language); -} \ No newline at end of file diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/drivenport/IWriteLines.java b/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/drivenport/IWriteLines.java deleted file mode 100644 index 79e43141..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/drivenport/IWriteLines.java +++ /dev/null @@ -1,15 +0,0 @@ -package poem.hexagon.boundary.drivenport; - -/** - * Driven, right side port for writing the lines of a poem to an output device - * outside the hexagon, e.g. the console. - * - * Inspired by a talk by A. Cockburn and T. Pierrain on hexagonal architecture: - * https://www.youtube.com/watch?v=th4AgBcrEHA - * - * @author b_muth - * - */ -public interface IWriteLines { - void writeLines(String[] strings); -} \ No newline at end of file diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/driverport/IReactToCommands.java b/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/driverport/IReactToCommands.java deleted file mode 100644 index b51d749d..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/boundary/driverport/IReactToCommands.java +++ /dev/null @@ -1,5 +0,0 @@ -package poem.hexagon.boundary.driverport; - -public interface IReactToCommands{ - void reactTo(Object command); -} diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/internal/commandhandler/DisplayRandomPoem.java b/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/internal/commandhandler/DisplayRandomPoem.java deleted file mode 100644 index e541aa31..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/internal/commandhandler/DisplayRandomPoem.java +++ /dev/null @@ -1,60 +0,0 @@ -package poem.hexagon.internal.commandhandler; - -import java.util.Arrays; -import java.util.List; -import java.util.Optional; -import java.util.function.Consumer; -import java.util.stream.Collectors; - -import poem.hexagon.boundary.command.AskForPoem; -import poem.hexagon.boundary.drivenport.IObtainPoems; -import poem.hexagon.boundary.drivenport.IWriteLines; -import poem.hexagon.internal.domain.Poem; -import poem.hexagon.internal.domain.RandomPoemPicker; - -/** - * The command handler for displaying a random poem. - * - * Inspired by a talk by A. Cockburn and T. Pierrain on hexagonal - * architecture: https://www.youtube.com/watch?v=th4AgBcrEHA - * - * @author b_muth - * - */ -public class DisplayRandomPoem implements Consumer { - private IObtainPoems poemObtainer; - private RandomPoemPicker randomPoemPicker; - private IWriteLines lineWriter; - - public DisplayRandomPoem(IObtainPoems poemObtainer, IWriteLines lineWriter) { - this.poemObtainer = poemObtainer; - this.randomPoemPicker = new RandomPoemPicker(); - this.lineWriter = lineWriter; - } - - @Override - public void accept(AskForPoem askForPoem) { - List poems = obtainPoems(askForPoem); - Optional poem = pickRandomPoem(poems); - writeLines(poem); - } - - private List obtainPoems(AskForPoem askForPoem) { - String language = askForPoem.getLanguage(); - String[] poems = poemObtainer.getMePoems(language); - List poemDomainObjects = - Arrays.stream(poems) - .map(Poem::new) - .collect(Collectors.toList()); - return poemDomainObjects; - } - - private Optional pickRandomPoem(List poemList) { - Optional randomPoem = randomPoemPicker.pickPoem(poemList); - return randomPoem; - } - - private void writeLines(Optional poem) { - poem.ifPresent(p -> lineWriter.writeLines(p.getVerses())); - } -} diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/internal/domain/Poem.java b/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/internal/domain/Poem.java deleted file mode 100644 index 668bba86..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/internal/domain/Poem.java +++ /dev/null @@ -1,58 +0,0 @@ -package poem.hexagon.internal.domain; - -import java.util.Objects; - -public class Poem { - private String[] verses; - - /** - * Constructs a poem with verses by splitting the specified text using - * newline characters. - * - * @param text the text of the poem - */ - public Poem(String text) { - Objects.requireNonNull(text); - this.verses = text.split("\\r?\\n"); - } - - /** - * Returns the individual verses of the poem. - * - * @return the verses - */ - public String[] getVerses() { - return verses; - } - - @Override - public String toString() { - final String newline = System.getProperty("line.separator"); - return String.join(newline, verses); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((verses == null) ? 0 : verses.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Poem other = (Poem) obj; - if (verses == null) { - if (other.verses != null) - return false; - } else if (!verses.equals(other.verses)) - return false; - return true; - } -} diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/internal/domain/RandomPoemPicker.java b/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/internal/domain/RandomPoemPicker.java deleted file mode 100644 index 2a84e9dc..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/hexagon/internal/domain/RandomPoemPicker.java +++ /dev/null @@ -1,41 +0,0 @@ -package poem.hexagon.internal.domain; - -import java.util.List; -import java.util.Objects; -import java.util.Optional; -import java.util.Random; - -/** - * Picks a random poem from a list of poems. - * - * Inspired by a talk by A. Cockburn and T. Pierrain on hexagonal architecture: - * https://www.youtube.com/watch?v=th4AgBcrEHA - * - * @author b_muth - * - */ -public class RandomPoemPicker { - private Random random; - - public RandomPoemPicker() { - this.random = new Random(); - } - - /** - * Picks a random poem from the specified list of poems. - * - * @param poems the poems to pick from - * @return a poem from the list, or an empty optional if the input list was empty - */ - public Optional pickPoem(List poems) { - Objects.requireNonNull(poems); - - if (poems.size() == 0) { - return Optional.empty(); - } - - int randomIndex = random.nextInt(poems.size()); - Poem randomPoem = poems.get(randomIndex); - return Optional.of(randomPoem); - } -} diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/simple/Main.java b/requirementsascodeexamples/hexagon/src/main/java/poem/simple/Main.java deleted file mode 100644 index a1fe5a7c..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/simple/Main.java +++ /dev/null @@ -1,33 +0,0 @@ -package poem.simple; - -import poem.hexagon.boundary.Boundary; -import poem.simple.drivenadapter.ConsoleWriter; -import poem.simple.drivenadapter.PoetryLibrary; -import poem.simple.driveradapter.Driver; - -/** - * Main class that starts the hexagon example application. - * - * Inspired by a talk by A. Cockburn and T. Pierrain on hexagonal architecture: - * https://www.youtube.com/watch?v=th4AgBcrEHA - * - * @author b_muth - * - */ -public class Main { - public static void main(String[] args) { - new Main().startApplication(); - } - - private void startApplication() { - // Instantiate driven, right-side adapters - PoetryLibrary poetryLibrary = new PoetryLibrary(); - ConsoleWriter consoleWriter = new ConsoleWriter(); - - // Inject driven adapters into boundary - Boundary boundary = new Boundary(poetryLibrary, consoleWriter); - - // Start the driver adapter for the application - new Driver(boundary).run(); - } -} diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/simple/drivenadapter/ConsoleWriter.java b/requirementsascodeexamples/hexagon/src/main/java/poem/simple/drivenadapter/ConsoleWriter.java deleted file mode 100644 index 3d3f0020..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/simple/drivenadapter/ConsoleWriter.java +++ /dev/null @@ -1,23 +0,0 @@ -package poem.simple.drivenadapter; - -import java.util.Objects; - -import poem.hexagon.boundary.drivenport.IWriteLines; - -/** - * Right-side, driven adapter for writing text to the console. - * - * Inspired by a talk by A. Cockburn and T. Pierrain on hexagonal architecture: - * https://www.youtube.com/watch?v=th4AgBcrEHA - * - * @author b_muth - * - */ -public class ConsoleWriter implements IWriteLines { - public void writeLines(String[] lines) { - Objects.requireNonNull(lines); - for (String line : lines) { - System.out.println(line); - } - } -} \ No newline at end of file diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/simple/drivenadapter/PoetryLibrary.java b/requirementsascodeexamples/hexagon/src/main/java/poem/simple/drivenadapter/PoetryLibrary.java deleted file mode 100644 index 814cccd2..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/simple/drivenadapter/PoetryLibrary.java +++ /dev/null @@ -1,29 +0,0 @@ -package poem.simple.drivenadapter; - -import poem.hexagon.boundary.drivenport.IObtainPoems; - -/** - * Right-side, driven adapter that acts as repository for poems. - * - * Inspired by a talk by A. Cockburn and T. Pierrain on hexagonal architecture: - * https://www.youtube.com/watch?v=th4AgBcrEHA - * - * @author b_muth - * - */ -public class PoetryLibrary implements IObtainPoems { - public String[] getMePoems(String language) { - if ("de".equals(language)) { - return new String[] { - "DER PANTHER\nIM JARDIN DES PLANTES, PARIS\n\nSein Blick ist vom Vorübergehn der Stäbe\nso müd geworden, daß er nichts mehr hält.\nIhm ist, als ob es tausend Stäbe gäbe\nund hinter tausend Stäben keine Welt.\n\nDer weiche Gang geschmeidig starker Schritte,\nder sich im allerkleinsten Kreise dreht,\nist wie ein Tanz von Kraft um eine Mitte,\nin der betäubt ein großer Wille steht.\n\nNur manchmal schiebt der Vorhang der Pupille\nsich lautlos auf –. Dann geht ein Bild hinein,\ngeht durch der Glieder angespannte Stille –\nund hört im Herzen auf zu sein.\n\n\n--“Der Panther“ von Rainer Maria Rilke", - "Ich sitze am Straßenrand\nDer Fahrer wechselt das Rad.\nIch bin nicht gern, wo ich herkomme.\nIch bin nicht gern, wo ich hinfahre.\nWarum sehe ich den Radwechsel\nMit Ungeduld?\n\n\n--“Der Radwechsel“ von Bertold Brecht" }; - - } else { - return new String[] { - "I'm nobody! Who are you?\nAre you nobody, too?\nThen there's a pair of us -- don't tell!\nThey'd advertise -- you know!\n\nHow dreary to be somebody!\nHow public like a frog\nTo tell one's name the livelong day\nTo an admiring bog!\n\n--“Im nobody! Who are you?“ by Emily Dickinson", - "Tyger! Tyger! burning bright\nIn the forests of the night,\nWhat immortal hand or eye,\nCould frame thy fearful symmetry?\n\nIn what distant deeps or skies\nBurnt the fire of thine eyes?\nOn what wings dare he aspire?\nWhat the hand dare seize the fire?\n\n-- “The Tyger” by William Blake", - "From childhood's hour I have not been\nAs others were — I have not seen\nAs others saw — I could not bring\nMy passions from a common spring —\nFrom the same source I have not taken\nMy sorrow — I could not awaken\nMy heart to joy at the same tone —\nAnd all I lov'd — I lov'd alone —\nThen — in my childhood — in the dawn\nOf a most stormy life — was drawn\nFrom ev'ry depth of good and ill\nThe mystery which binds me still —\nFrom the torrent, or the fountain —\nFrom the red cliff of the mountain —\nFrom the sun that 'round me roll'd\nIn its autumn tint of gold —\nFrom the lightning in the sky\nAs it pass'd me flying by —\nFrom the thunder, and the storm —\nAnd the cloud that took the form\n(When the rest of Heaven was blue)\nOf a demon in my view — \n\n--“Alone“ by Edgar Allan Poe" }; - - } - } -} \ No newline at end of file diff --git a/requirementsascodeexamples/hexagon/src/main/java/poem/simple/driveradapter/Driver.java b/requirementsascodeexamples/hexagon/src/main/java/poem/simple/driveradapter/Driver.java deleted file mode 100644 index 0785d497..00000000 --- a/requirementsascodeexamples/hexagon/src/main/java/poem/simple/driveradapter/Driver.java +++ /dev/null @@ -1,29 +0,0 @@ -package poem.simple.driveradapter; - -import poem.hexagon.boundary.command.AskForPoem; -import poem.hexagon.boundary.driverport.IReactToCommands; - -/** - * The driver adapter. It's on the left side of the hexagon. It sends user - * requests as command objects to a driver port on the hexagon boundary. (For simplicitly, - * sending is done autonomously without user interaction.) - * - * Inspired by a talk by A. Cockburn and T. Pierrain on hexagonal architecture: - * https://www.youtube.com/watch?v=th4AgBcrEHA - * - * @author b_muth - * - */ -public class Driver { - private IReactToCommands driverPort; - - public Driver(IReactToCommands driverPort) { - this.driverPort = driverPort; - } - - public void run() { - driverPort.reactTo(new AskForPoem("en")); - System.out.println(""); - driverPort.reactTo(new AskForPoem("de")); - } -} diff --git a/requirementsascodeexamples/hexagon/src/test/java/poem/hexagon/internal/domain/RandomPoemPickerTest.java b/requirementsascodeexamples/hexagon/src/test/java/poem/hexagon/internal/domain/RandomPoemPickerTest.java deleted file mode 100644 index 1d9123e1..00000000 --- a/requirementsascodeexamples/hexagon/src/test/java/poem/hexagon/internal/domain/RandomPoemPickerTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package poem.hexagon.internal.domain; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.util.Arrays; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - -import org.junit.Before; -import org.junit.Test; - -public class RandomPoemPickerTest { - private RandomPoemPicker randomPoemPicker; - - @Before - public void setUp() throws Exception { - this.randomPoemPicker = new RandomPoemPicker(); - } - - @Test - public void picks_random_poem_from_empty_list() { - List poemsList = createPoemList(); - - Optional randomPoem = randomPoemPicker.pickPoem(poemsList); - assertFalse(randomPoem.isPresent()); - } - - @Test - public void picks_random_poem_from_single_element_list() { - List poemsList = createPoemList("Poem1"); - - Optional randomPoem = randomPoemPicker.pickPoem(poemsList); - assertEquals("Poem1", randomPoem.get().toString()); - } - - @Test - public void picks_random_poem_from_mutiple_element_list() { - List poemsList = createPoemList("Poem1", "Poem2", "Poem3"); - - Optional randomPoem = randomPoemPicker.pickPoem(poemsList); - assertTrue(poemsList.contains(randomPoem.get())); - } - - private List createPoemList(String... poems) { - List poemList = Arrays.stream(poems) - .map(Poem::new) - .collect(Collectors.toList()); - return poemList; - } -} diff --git a/settings.gradle b/settings.gradle index 22757d3a..ce990737 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,7 +4,6 @@ include 'requirementsascodeexamples:helloworld' include 'requirementsascodeexamples:shoppingappjavafx' include 'requirementsascodeexamples:shoppingappextract' include 'requirementsascodeexamples:crosscuttingconcerns' -include 'requirementsascodeexamples:hexagon' include 'requirementsascodeexamples:akka' include 'requirementsascodeexamples:creditcard_eventsourcing'