Java 测试规范框架:Spek
                 jopen
                 12年前
            
                    Spek 是 JetBrains 开发的 JVM 的一个规范框架,通过优雅的 DSL 来清晰描述你的代码规范。
一般的测试代码:
@Test  public void testCalculateTaxRate() {      TaxRateCalculator calculator = new TaxRateCalculator();      Int value = calculator.calculateRate(200, 10);      assertEquals(300,value);  } 使用 Spek 的测试代码:
class TaxCalculatorSpecs: Spek() {{        given("Tax rate calculator with default locale settings") {          val taxRateCalculator = TaxRateCalculator()          on("calculating the rate for an income of 200 and an average change of 10 per semester") {              val value = taxRateCalculator.calculateRate(200, 10)              it("should result in a value of 300") {                  assertEquals(300, value)              }          }      }  }}