Skip to content

Commit

Permalink
Add test for varargs formatting #351
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Schäfer committed Jul 28, 2018
1 parent 09ce6b1 commit ea411a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ public GivenTestStep a_step_with_an_As_annotation_and_a_custom_provider() {
return self();
}

public GivenTestStep varargs_as_parameters_$( String... params ) {
return self();
}

public GivenTestStep ALLUPPERCASE() {
return self();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
import com.tngtech.jgiven.ScenarioTestBaseForTesting;
import com.tngtech.jgiven.ThenTestStep;
import com.tngtech.jgiven.WhenTestStep;
import com.tngtech.jgiven.annotation.Format;
import com.tngtech.jgiven.annotation.Formatf;
import com.tngtech.jgiven.annotation.NamedFormat;
import com.tngtech.jgiven.annotation.POJOFormat;
import com.tngtech.jgiven.annotation.Quoted;
import com.tngtech.jgiven.annotation.*;
import com.tngtech.jgiven.annotation.POJOFormat.BracketsEnum;
import com.tngtech.jgiven.exception.JGivenWrongUsageException;
import com.tngtech.jgiven.format.BooleanFormatter;
Expand Down Expand Up @@ -366,6 +362,16 @@ public void step_comments_are_printed() throws UnsupportedEncodingException {
assertThat( string ).contains( "something [This is a comment.]" );
}

@Test
public void varargs_formatting() throws UnsupportedEncodingException {
getScenario().startScenario( "varargs" );

given().varargs_as_parameters_$( "a", "b", "c" );

String string = PlainTextReporter.toString( getScenario().getScenarioModel() );
assertThat( string ).contains( "Given varargs as parameters a, b, c" );
}

@Test
public void pojo_format_is_working() throws Throwable {
getScenario().startScenario( "test" );
Expand Down

0 comments on commit ea411a0

Please sign in to comment.