Better HN
topnewbestaskshowjobs
Log inSign up

nowimaman

1 karma · joined Feb 1, 2024 (2y ago) · 1 submissions

Submissions

comment 2y ago · link · parent

Spock is the most readable framework for testing java IMO, their data driven testing is great, but it might not be a fair comparison because it's written with groovy:

  def 'split #input with sep #sep should return #expected'() {
    expect:
    Split(input, sep) == expected

    where:
    testCase      | input   | sep || expected
    "simple"      | "a/b/c" | "/" || ['a', 'b', 'c']
    "wrong sep"   | "a/b/c" | "," || ['a/b/c']
    "no sep"      | "abc"   | "/" || ['abc']
    "trailing sep"| "a/b/c/"| "/" || ['a', 'b', 'c']
  }