Examples of valueAs()


Examples of org.jbehave.core.steps.Parameters.valueAs()

        String tableAsString = "|one|two|\n|11|22|\n";
        ExamplesTable examplesTable = factory.createExamplesTable(tableAsString);

        // Then
        Parameters integers = examplesTable.getRowAsParameters(0);
        assertThat(integers.valueAs("one", Integer.class), equalTo(11));
        try {
            integers.valueAs("unknown", Integer.class);
        } catch (ValueNotFound e) {
            assertThat(e.getMessage(), equalTo("unknown"));
        }
View Full Code Here

Examples of org.jbehave.core.steps.Parameters.valueAs()

        // Then
        Parameters integers = examplesTable.getRowAsParameters(0);
        assertThat(integers.valueAs("one", Integer.class), equalTo(11));
        try {
            integers.valueAs("unknown", Integer.class);
        } catch (ValueNotFound e) {
            assertThat(e.getMessage(), equalTo("unknown"));
        }
        try {
            examplesTable.getRowAsParameters(1);
View Full Code Here

Examples of org.jbehave.core.steps.Parameters.valueAs()

        otherValues.put("two", "222");
        examplesTable.withRowValues(1, otherValues);

        // Then
        Parameters firstRow = examplesTable.getRowAsParameters(0);
        assertThat(firstRow.valueAs("one", Integer.class), equalTo(111));
        assertThat(firstRow.valueAs("two", Integer.class), equalTo(12));
        assertThat(firstRow.valueAs("three", Integer.class), equalTo(333));
        Parameters secondRow = examplesTable.getRowAsParameters(1);
        assertThat(secondRow.valueAs("one", Integer.class), equalTo(21));
        assertThat(secondRow.valueAs("two", Integer.class), equalTo(222));
View Full Code Here

Examples of org.jbehave.core.steps.Parameters.valueAs()

        examplesTable.withRowValues(1, otherValues);

        // Then
        Parameters firstRow = examplesTable.getRowAsParameters(0);
        assertThat(firstRow.valueAs("one", Integer.class), equalTo(111));
        assertThat(firstRow.valueAs("two", Integer.class), equalTo(12));
        assertThat(firstRow.valueAs("three", Integer.class), equalTo(333));
        Parameters secondRow = examplesTable.getRowAsParameters(1);
        assertThat(secondRow.valueAs("one", Integer.class), equalTo(21));
        assertThat(secondRow.valueAs("two", Integer.class), equalTo(222));
        assertThat(secondRow.valueAs("three", String.class), equalTo(""));
View Full Code Here

Examples of org.jbehave.core.steps.Parameters.valueAs()

        // Then
        Parameters firstRow = examplesTable.getRowAsParameters(0);
        assertThat(firstRow.valueAs("one", Integer.class), equalTo(111));
        assertThat(firstRow.valueAs("two", Integer.class), equalTo(12));
        assertThat(firstRow.valueAs("three", Integer.class), equalTo(333));
        Parameters secondRow = examplesTable.getRowAsParameters(1);
        assertThat(secondRow.valueAs("one", Integer.class), equalTo(21));
        assertThat(secondRow.valueAs("two", Integer.class), equalTo(222));
        assertThat(secondRow.valueAs("three", String.class), equalTo(""));
        assertThat(examplesTable.asString(), equalTo("|one|two|three|\n|111|12|333|\n|21|222||\n"));
View Full Code Here

Examples of org.jbehave.core.steps.Parameters.valueAs()

        Parameters firstRow = examplesTable.getRowAsParameters(0);
        assertThat(firstRow.valueAs("one", Integer.class), equalTo(111));
        assertThat(firstRow.valueAs("two", Integer.class), equalTo(12));
        assertThat(firstRow.valueAs("three", Integer.class), equalTo(333));
        Parameters secondRow = examplesTable.getRowAsParameters(1);
        assertThat(secondRow.valueAs("one", Integer.class), equalTo(21));
        assertThat(secondRow.valueAs("two", Integer.class), equalTo(222));
        assertThat(secondRow.valueAs("three", String.class), equalTo(""));
        assertThat(examplesTable.asString(), equalTo("|one|two|three|\n|111|12|333|\n|21|222||\n"));
    }
View Full Code Here

Examples of org.jbehave.core.steps.Parameters.valueAs()

        assertThat(firstRow.valueAs("one", Integer.class), equalTo(111));
        assertThat(firstRow.valueAs("two", Integer.class), equalTo(12));
        assertThat(firstRow.valueAs("three", Integer.class), equalTo(333));
        Parameters secondRow = examplesTable.getRowAsParameters(1);
        assertThat(secondRow.valueAs("one", Integer.class), equalTo(21));
        assertThat(secondRow.valueAs("two", Integer.class), equalTo(222));
        assertThat(secondRow.valueAs("three", String.class), equalTo(""));
        assertThat(examplesTable.asString(), equalTo("|one|two|three|\n|111|12|333|\n|21|222||\n"));
    }

    @Test
View Full Code Here

Examples of org.jbehave.core.steps.Parameters.valueAs()

        assertThat(firstRow.valueAs("two", Integer.class), equalTo(12));
        assertThat(firstRow.valueAs("three", Integer.class), equalTo(333));
        Parameters secondRow = examplesTable.getRowAsParameters(1);
        assertThat(secondRow.valueAs("one", Integer.class), equalTo(21));
        assertThat(secondRow.valueAs("two", Integer.class), equalTo(222));
        assertThat(secondRow.valueAs("three", String.class), equalTo(""));
        assertThat(examplesTable.asString(), equalTo("|one|two|three|\n|111|12|333|\n|21|222||\n"));
    }

    @Test
    public void shouldAllowBuildingOfTableFromContent() throws Exception {
View Full Code Here

Examples of org.jbehave.core.steps.Parameters.valueAs()

    // Returns just the first row in the users' credentials table
    public static UserPassCredentials getDefaultCredentialsFromTable(
            ExamplesTable credentialsTable) {
        assert credentialsTable.getRowCount() > 0 : "user table must have at least 1 row";
        Parameters firstRow = credentialsTable.getRowAsParameters(0);
        String username = firstRow.valueAs("username", String.class);
        String password = firstRow.valueAs("password", String.class);

        return new UserPassCredentials(username, password);
    }
View Full Code Here

Examples of org.jbehave.core.steps.Parameters.valueAs()

    public static UserPassCredentials getDefaultCredentialsFromTable(
            ExamplesTable credentialsTable) {
        assert credentialsTable.getRowCount() > 0 : "user table must have at least 1 row";
        Parameters firstRow = credentialsTable.getRowAsParameters(0);
        String username = firstRow.valueAs("username", String.class);
        String password = firstRow.valueAs("password", String.class);

        return new UserPassCredentials(username, password);
    }

    public static List<FalsePositive> getFalsePositivesFromTable(ExamplesTable falseps) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.