コード例 #1
0
  @Test
  public void the_returned_test_steps_list_should_be_read_only() {
    testOutcome.recordStep(forASuccessfulTestStepCalled("The user opens the Google search page"));

    List<TestStep> testSteps = testOutcome.getTestSteps();
    assertThat(testOutcome.toString(), is("The user opens the Google search page"));

    try {
      testSteps.add(new TestStep("Some other step"));
      fail("An UnsupportedOperationException exception should have been thrown");
    } catch (UnsupportedOperationException e) {
      assertThat(testOutcome.toString(), is("The user opens the Google search page"));
    }
  }