Micha Kops avatar Micha Kops committed 362af46

BDD syntax example added.

Comments (0)

Files changed (1)


+package com.hascode
+import org.scalatest.GivenWhenThen
+import org.scalatest.FlatSpec
+import org.scalatest.matchers.MustMatchers
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+class BDDSyntaxExample extends FlatSpec with MustMatchers with GivenWhenThen {
+  "A HashMap" should "allow an item to be added" in {
+    Given("an empty hashmap of type Int->String")
+    val map = collection.mutable.Map[Int, String]()
+    When("an item is added")
+    map += (1 -> "Joe")
+    Then("the map should have size 1")
+    map must have size (1)
+    And("the map must contain the item added")
+    map must (contain key (1) and contain value ("Joe"))
+    info("Adding items seems to be working")
+  }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.