Skip to content

Commit

Permalink
Added a unit test to show the problem
Browse files Browse the repository at this point in the history
  • Loading branch information
sirchia committed Nov 9, 2013
1 parent 3309638 commit 90e3b1a
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions java/src/test/java/gherkin/formatter/FilterFormatterTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package gherkin.formatter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

import org.junit.Test;

import gherkin.formatter.model.Examples;
import gherkin.formatter.model.Tag;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;

public class FilterFormatterTest {

@Test
public void filterFormatterShouldNotClearExampleTags() {

FilterFormatter filterFormatter = new FilterFormatter(mock(Formatter.class), Arrays.asList("@filter"));

final ArrayList<Tag> originalTags = new ArrayList<Tag>();
originalTags.add(new Tag("@tag", 0));

Examples examples1 = new Examples(Collections.EMPTY_LIST, new ArrayList<Tag>(originalTags),
"keyword1", "name1", "description1", 0, "id1", Collections.EMPTY_LIST);
Examples examples2 = new Examples(Collections.EMPTY_LIST, new ArrayList<Tag>(originalTags),
"keyword2", "name2", "description2", 0, "id2", Collections.EMPTY_LIST);

filterFormatter.examples(examples1);
filterFormatter.examples(examples2);

assertEquals("Example tags should not be modified", originalTags, examples1.getTags());
assertEquals("Example tags should not be modified", originalTags, examples2.getTags());
}
}

0 comments on commit 90e3b1a

Please sign in to comment.