Package org.eluder.coveralls.maven.plugin.domain

Examples of org.eluder.coveralls.maven.plugin.domain.Source


    }

    @Override
    public Source load(final String sourceFile) throws IOException {
        for (SourceLoader sourceLoader : sourceLoaders) {
            Source source = sourceLoader.load(sourceFile);
            if (source != null) {
                return source;
            }
        }
        throw new IOException("No source found for " + sourceFile);
View Full Code Here


        InputStream stream = locate(sourceFile);
        if (stream != null) {
            InputStreamReader reader = new InputStreamReader(stream, getSourceEncoding());
            try {
                String source = IOUtil.toString(reader);
                return new Source(getFileName(sourceFile), source);
            } finally {
                IOUtil.close(reader);
            }
        } else {
            return null;
View Full Code Here

        when(sourceLoaderMock.load(anyString())).then(new Answer<Source>() {
            @Override
            public Source answer(final InvocationOnMock invocation) throws Throwable {
                String sourceFile = invocation.getArguments()[0].toString();
                String content = readFileContent(sourceFile);
                return new Source(sourceFile, content);
            }
        });
        when(logMock.isInfoEnabled()).thenReturn(true);
        when(jobMock.validate()).thenReturn(new ValidationErrors());
       
View Full Code Here

            .withTimestamp(new Date(TEST_TIME))
            .withGit(new Git(null, head, "af456fge34acd", Arrays.asList(remote)));
    }
   
    private Source source() {
        return new Source("Foo.java", "public class Foo { }");
    }
View Full Code Here

   
    @Test
    public void testPrimarySource() throws Exception {
        when(sl1.load("source")).thenReturn(s1);
        when(sl2.load("source")).thenReturn(s2);
        Source source = creaMultiSourceLoader().load("source");
        assertSame(s1, source);
    }
View Full Code Here

    }
   
    @Test
    public void testSecondarySource() throws Exception {
        when(sl2.load("source")).thenReturn(s2);
        Source source = creaMultiSourceLoader().load("source");
        assertSame(s2, source);
    }
View Full Code Here

    @Mock
    private SourceCallback sourceCallbackMock;
   
    @Test
    public void testOnSourceWithUniqueSources() throws Exception {
        Source s1 = createSource("Foo.java", "{\n  void();\n}\n", 2);
        Source s2 = createSource("Bar.java", "{\n  bar();\n}\n", 2);
       
        UniqueSourceCallback cb = createUniqueSourceCallback();
        cb.onSource(s1);
        cb.onSource(s2);
        verify(sourceCallbackMock, times(2)).onSource(Mockito.any(Source.class));
View Full Code Here

        verify(sourceCallbackMock, times(2)).onSource(Mockito.any(Source.class));
    }

    @Test
    public void testOnSourceWithDuplicateSources() throws Exception {
        Source s1 = createSource("Foo.java", "{\n  void();\n}\n", 2);

        UniqueSourceCallback cb = createUniqueSourceCallback();
        cb.onSource(s1);
        cb.onSource(s1);
        verify(sourceCallbackMock, times(1)).onSource(Mockito.any(Source.class));
View Full Code Here

        verify(sourceCallbackMock, times(1)).onSource(Mockito.any(Source.class));
    }

    @Test
    public void testOnSourceWithUniqueRelevantLines() throws Exception {
        Source s1 = createSource("Foo.java", "{\n  void();\n}\n", 2);
        Source s2 = createSource("Foo.java", "{\n  void();\n}\n", 1, 3);

        UniqueSourceCallback cb = createUniqueSourceCallback();
        cb.onSource(s1);
        cb.onSource(s2);
        verify(sourceCallbackMock, times(2)).onSource(Mockito.any(Source.class));
View Full Code Here

    private UniqueSourceCallback createUniqueSourceCallback() {
        return new UniqueSourceCallback(sourceCallbackMock);
    }
   
    private Source createSource(final String name, final String source, final int... relevant) {
        Source s = new Source(name, source);
        for (int i : relevant) {
            s.addCoverage(i, 1);
        }
        return s;
    }
View Full Code Here

TOP

Related Classes of org.eluder.coveralls.maven.plugin.domain.Source

Copyright © 2018 www.massapicom. 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.