Skip to content

Commit

Permalink
Simplify test to ensure both snippets are compatible
Browse files Browse the repository at this point in the history
Issue: TNG#54
Signed-off-by: Johannes Thorn <2544827+johthor@users.noreply.github.com>
  • Loading branch information
johthor committed Jul 17, 2024
1 parent 9261ea6 commit eac0513
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ final class MetadataMapper {
private static final int NANOSECONDS_PER_MILLISECOND = 1000000;

private MetadataMapper() {
// static helper class not intended to be instantiated
// static helper class isn't intended to be instantiated
}

static String toAsciiDocTagStart(ExecutionStatus executionStatus) {
static String toAsciiDocStartTag(ExecutionStatus executionStatus) {
return "// tag::" + toAsciiDocTagName(executionStatus) + "[]";
}

static String toAsciiDocTagEnd(ExecutionStatus executionStatus) {
static String toAsciiDocEndTag(ExecutionStatus executionStatus) {
return "// end::" + toAsciiDocTagName(executionStatus) + "[]";
}

static String toAsciiDocTagName(final ExecutionStatus executionStatus) {
private static String toAsciiDocTagName(final ExecutionStatus executionStatus) {
switch (executionStatus) {
case SCENARIO_PENDING:
case SOME_STEPS_PENDING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,20 @@
*/
@RunWith(DataProviderRunner.class)
public class MetadataMapperTest {

@Test
public void toAsciiDocTagStart() {
final String actualName = MetadataMapper.toAsciiDocTagStart(ExecutionStatus.SUCCESS);

assertThat(actualName).isEqualTo("// tag::scenario-successful[]");
}

@Test
public void toAsciiDocTagEnd() {
final String actualName = MetadataMapper.toAsciiDocTagEnd(ExecutionStatus.SUCCESS);

assertThat(actualName).isEqualTo("// end::scenario-successful[]");
}

@Test
@DataProvider({
"SUCCESS, scenario-successful",
"FAILED, scenario-failed",
"SCENARIO_PENDING, scenario-pending",
"SOME_STEPS_PENDING, scenario-pending"})
public void toAsciiDocTagName(final ExecutionStatus executionStatus, final String expectedName) {
final String actualName = MetadataMapper.toAsciiDocTagName(executionStatus);
// when
final String startSnippet = MetadataMapper.toAsciiDocStartTag(executionStatus);
final String endSnippet = MetadataMapper.toAsciiDocEndTag(executionStatus);

assertThat(actualName).isEqualTo(expectedName);
// then
assertThat(startSnippet).isEqualTo("// tag::" + expectedName + "[]");
assertThat(endSnippet).isEqualTo("// end::" + expectedName + "[]");
}

@Test
Expand Down Expand Up @@ -86,7 +75,7 @@ public void toScenarioDurationForDurationOver1ms(final long nanoseconds, final S
}

@Test
public void toStepDurationBelow1ms() {
public void toStepDurationBelow10ms() {
final String actualDuration = MetadataMapper.toHumanReadableStepDuration(9_999_999);

assertThat(actualDuration).isEmpty();
Expand Down

0 comments on commit eac0513

Please sign in to comment.