Projects >> jbehave-core >>c9d3b43ddac777ccf04dca70ec0854ffd349d23b

Chunk
Conflicting content
import org.junit.Test;

<<<<<<< HEAD
import static org.hamcrest.MatcherAssert.assertThat;

import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.not;
=======
import static java.util.Arrays.asList;

import static org.hamcrest.MatcherAssert.assertThat;

import static org.hamcrest.Matchers.equalTo;
>>>>>>> 73a6b0664b4848249b178a6bb0e8ffcd849f8efc

public class JarFileScannerBehaviour {
Solution content
import org.junit.Test;

import static org.hamcrest.MatcherAssert.assertThat;

import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.not;

public class JarFileScannerBehaviour {
File
JarFileScannerBehaviour.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
public class JarFileScannerBehaviour {

    @Test
<<<<<<< HEAD
    public void shouldScanJarFromPath() throws IOException {
        List paths = scan("src/test/resources/stories.jar", "**/*.story", "**/*_search.story");
        assertThat(paths, hasItems("etsy_browse.story", "etsy_cart.story"));
        assertThat(paths, not(hasItems("etsy_search.story")));
    }

    @Test
    public void shouldScanJarFromPathWithNoExcludes() throws IOException {
        assertThat(scan("src/test/resources/stories.jar", "**/*.story", ""),
                hasItems("etsy_browse.story", "etsy_cart.story", "etsy_search.story"));
        assertThat(scan("src/test/resources/stories.jar", "**/*.story", null),
                hasItems("etsy_browse.story", "etsy_cart.story", "etsy_search.story"));
    }

    @Test
    public void shouldScanJarFromPathWithNoIncludes() throws IOException {
        assertThat(scan("src/test/resources/stories.jar", "", "**/*.story"),
                not(hasItems("etsy_browse.story", "etsy_cart.story", "etsy_search.story")));
        assertThat(scan("src/test/resources/stories.jar", null, "**/*.story"),
                not(hasItems("etsy_browse.story", "etsy_cart.story", "etsy_search.story")));
    }

    private List scan(String jarPath, String includes, String excludes) {
        return new JarFileScanner(jarPath, includes, excludes).scan();
=======
    public void shouldScanFileFromPath() throws IOException {
        String jarPath = "src/test/resources/stories.jar";
        JarFileScanner scanner = new JarFileScanner(jarPath, "**/*.story", "**/*_search.story");
        assertThat(scanner.scan(), equalTo(asList("etsy_browse.story", "etsy_cart.story")));
    }

    @Test
    public void shouldScanFileFromURL() throws IOException {
        URL jarURL = CodeLocations.codeLocationFromPath("src/test/resources/stories.jar");
        JarFileScanner scanner = new JarFileScanner(jarURL, "**/*.story", "**/*_search.story");
        assertThat(scanner.scan(), equalTo(asList("etsy_browse.story", "etsy_cart.story")));
>>>>>>> 73a6b0664b4848249b178a6bb0e8ffcd849f8efc
    }

}
Solution content
public class JarFileScannerBehaviour {

    @Test
    public void shouldScanJarFromPath() throws IOException {
        List paths = scan("src/test/resources/stories.jar", "**/*.story", "**/*_search.story");
        assertThat(paths, hasItems("etsy_browse.story", "etsy_cart.story"));
        assertThat(paths, not(hasItems("etsy_search.story")));
    }

    @Test
    public void shouldScanJarFromPathWithNoExcludes() throws IOException {
        assertThat(scan("src/test/resources/stories.jar", "**/*.story", ""),
                hasItems("etsy_browse.story", "etsy_cart.story", "etsy_search.story"));
        assertThat(scan("src/test/resources/stories.jar", "**/*.story", null),
                hasItems("etsy_browse.story", "etsy_cart.story", "etsy_search.story"));
    }

    @Test
    public void shouldScanJarFromPathWithNoIncludes() throws IOException {
        assertThat(scan("src/test/resources/stories.jar", "", "**/*.story"),
                not(hasItems("etsy_browse.story", "etsy_cart.story", "etsy_search.story")));
        assertThat(scan("src/test/resources/stories.jar", null, "**/*.story"),
                not(hasItems("etsy_browse.story", "etsy_cart.story", "etsy_search.story")));
    }

    private List scan(String jarPath, String includes, String excludes) {
        return new JarFileScanner(jarPath, includes, excludes).scan();
    }

}
File
JarFileScannerBehaviour.java
Developer's decision
Version 1
Kind of conflict
Annotation
Method declaration
Method invocation
Method signature
Return statement
Variable