Package org.jbehave.core.model

Examples of org.jbehave.core.model.OutcomesTable


        reporter.successful("When I ask Liz for a loan of $100");
        reporter.afterScenario();

        // 2nd scenario
        reporter.beforeScenario("A failing scenario");
        OutcomesTable outcomesTable = new OutcomesTable();
        outcomesTable.addOutcome("I don't return all", 100.0, equalTo(50.));
        try {
            outcomesTable.verify();
        } catch (UUIDExceptionWrapper e) {
            reporter.failedOutcomes("Then I don't return loan", ((OutcomesFailed)e.getCause()).outcomesTable());
        }
        reporter.notPerformed("Then I should have $20");
        ExamplesTable table = new ExamplesTable("|money|to|\n|$30|Mauro|\n|$50|Paul|\n");
View Full Code Here


    }
  }

  @Then("the traders returned are: %tradersTable")
  public void theTradersReturnedAre(ExamplesTable tradersTable) {
    OutcomesTable outcomes = new OutcomesTable();
    outcomes.addOutcome("traders", searchedTraders.toString(), equalTo(toTraders(tradersTable).toString()));
    outcomes.addOutcome("a success", "Any Value", equalTo("Any Value"));
    outcomes.verify();
  }
View Full Code Here

        filter.example(tableRow);
        filter.successful("Given step 3.1");
        filter.successful("When step 3.2");
        filter.ignorable("!-- ignore me too");
        filter.failed("Then step 3.3", anException);
        OutcomesTable outcomesTable = new OutcomesTable();
        filter.failedOutcomes("When failed outcomes", outcomesTable);
        filter.afterExamples();
        filter.afterScenario();

        filter.beforeScenario("My scenario 4");
View Full Code Here

            reporter.failed("Then I should have a balance of $30", new Exception("Expected <30> got <25>"));
        } else {
            reporter.pending("Then I should have a balance of $30");
        }
        reporter.notPerformed("Then I should have $20");
        OutcomesTable outcomesTable = new OutcomesTable(new LocalizedKeywords(), "dd/MM/yyyy");
        outcomesTable.addOutcome("I don't return all", 100.0, equalTo(50.));
        Date actualDate = dateFor("01/01/2011");
        Date expectedDate = dateFor("02/01/2011");
        outcomesTable.addOutcome("A wrong date", actualDate, new IsDateEqual(expectedDate, outcomesTable.getDateFormat()));
        try {
            outcomesTable.verify();
        } catch (UUIDExceptionWrapper e) {
            reporter.failedOutcomes("Then I don't return loan", ((OutcomesFailed) e.getCause()).outcomesTable());
        }
        reporter.afterScenario();
        reporter.beforeScenario("Parametrised Scenario");
View Full Code Here

        assertThat(rowValues.get(column), equalTo(value));
    }

    @Then("les valeurs multipliées par $multiplier sont: $table")
    public void theResultsMultipliedByAre(int multiplier, ExamplesTable results){
        OutcomesTable outcomes = new OutcomesTable(new LocalizedKeywords(new Locale("fr")));
        for (int row = 0; row < results.getRowCount(); row++) {
            Parameters expected = results.getRowAsParameters(row);
            Parameters original = table.getRowAsParameters(row);
            int one = original.valueAs("un", Integer.class);
            int two = original.valueAs("deux", Integer.class);
            outcomes.addOutcome("un", one*multiplier, Matchers.equalTo(expected.valueAs("un", Integer.class)));
            outcomes.addOutcome("deux", two*multiplier, Matchers.equalTo(expected.valueAs("deux", Integer.class)));
        }
        outcomes.verify();
    }
View Full Code Here

        // Given
        OutputStream out = new ByteArrayOutputStream();
        StoryReporter reporter = new TxtOutput(new PrintStream(out));

        // When
        OutcomesTable outcomesTable = new OutcomesTable(new LocalizedKeywords(), "dd/MM/yyyy");
        Date actualDate = StoryNarrator.dateFor("01/01/2011");
        Date expectedDate = StoryNarrator.dateFor("02/01/2011");
        outcomesTable.addOutcome("A wrong date", actualDate, new IsDateEqual(expectedDate, outcomesTable.getDateFormat()));
        try {
            outcomesTable.verify();
        } catch (UUIDExceptionWrapper e) {
            reporter.failedOutcomes("some step", ((OutcomesFailed) e.getCause()).outcomesTable());
        }

        // Then
View Full Code Here

    public void shouldProvideFailureCauseWithMessageDescribingStep() {
        // Given
        Throwable t = new UUIDExceptionWrapper(new IllegalArgumentException("World Peace for everyone"));
        // When
        decorator.failed("When I have a bad idea", t);
        OutcomesTable table = new OutcomesTable();
        decorator.failedOutcomes("When outcomes fail", table);

        // Then
        verify(delegate).failed(Mockito.eq("When I have a bad idea"), Mockito.eq(t));
        verify(delegate).failedOutcomes(Mockito.eq("When outcomes fail"), Mockito.eq(table));
View Full Code Here

    car = new Car();
  }

  @Then("I can drive them according to wheels: $table")
  public void thenICanDriveThemAccordingTo(ExamplesTable table) {
    OutcomesTable outcomes = new OutcomesTable();
    for ( Parameters row : table.getRowsAsParameters() ){
      Integer wheels = row.valueAs("wheels", Integer.class);
      Boolean canDriveWith = car.canDriveWith(wheels);
      outcomes.addOutcome("wheels "+wheels, canDriveWith, Matchers.is(row.valueAs("can_drive", Boolean.class)));
    }
    outcomes.verify();
  }
View Full Code Here

        ignorable(ignorable).describeTo(reporter);
        String failed = "And any errors should appear at the end of the story";
        UUIDExceptionWrapper cause = new UUIDExceptionWrapper(new IllegalStateException());
        failed(failed, cause).describeTo(reporter);
        String failedOutcomes = "And outcomes failed";
        OutcomesTable outcomesTable = new OutcomesTable();
        failed(failedOutcomes, new UUIDExceptionWrapper(new OutcomesFailed(outcomesTable))).describeTo(reporter);
        skipped().describeTo(reporter);

        // Then
        verify(reporter).successful(successful);
View Full Code Here

    static class FailingSteps extends Steps {

        @When("outcome fails for $name upon verification")
        public void whenOutcomeFails(String name) {
            OutcomesTable outcomes = new OutcomesTable();
            outcomes.addOutcome("failing", name, equalTo(""));
            outcomes.verify();
        }
View Full Code Here

TOP

Related Classes of org.jbehave.core.model.OutcomesTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.