Skip to content

Instantly share code, notes, and snippets.

@varmas
Created May 29, 2019 00:25
Show Gist options
  • Save varmas/f4c8c77a47a00d00eae3004bc7acf801 to your computer and use it in GitHub Desktop.
Save varmas/f4c8c77a47a00d00eae3004bc7acf801 to your computer and use it in GitHub Desktop.
override methods for test
it should "something dirty" in {
val list: java.util.List[String]= new java.util.ArrayList[String] {
@throws(classOf[NullPointerException])
override def get(a: Int): String = {
throw new NullPointerException()
}
}
a[NullPointerException] should be thrownBy { // Result type: Assertion
list.get(0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment