Examples of MockLocation


Examples of org.apache.rat.document.MockLocation

    }

    @Test
    public void match() throws Exception {
        ApacheSoftwareLicense20 worker = new ApacheSoftwareLicense20();
        final Document subject = new MockLocation("subject");
        assertTrue(worker.match(subject, ApacheSoftwareLicense20.FIRST_LICENSE_LINE));
        assertTrue(worker.match(subject, "    Licensed under the Apache License, Version 2.0 (the \"License\");"));
        assertTrue(worker.match(subject, "Licensed under the Apache License, Version 2.0 (the \"License\");"));
        assertTrue(worker.match(subject, " * Licensed under the Apache License, Version 2.0 (the \"License\");"));
        assertTrue(worker.match(subject, " // Licensed under the Apache License, Version 2.0 (the \"License\");"));
View Full Code Here

Examples of org.apache.rat.document.MockLocation

        reporter = new MockClaimReporter();
    }

    @Test
    public void match() throws Exception {
        final Document subject = new MockLocation("subject");
        assertTrue("Expected matcher to return license", license.match(subject, COPYRIGHT_URL));
        assertTrue("Expected matcher to return license", license.match(subject, COPYRIGHT_URL_COMMENTED));
        assertTrue("Expected matcher to return license", license.match(subject, COPYRIGHT_URL_XML));
        assertFalse("Return null if the license isn't matched", license.match(subject, "Bogus"));
    }
View Full Code Here

Examples of org.apache.rat.document.MockLocation

    @Before
    public void setUp() throws Exception {
        reporter = new MockClaimReporter();
        policy = new DefaultPolicy();
        subject = new MockLocation("subject");
    }
View Full Code Here

Examples of org.apache.rat.document.MockLocation

public class HeaderCheckWorkerTest {

    @Test
    public void isFinished() throws Exception {
        final Document subject = new MockLocation("subject");
        HeaderCheckWorker worker = new HeaderCheckWorker(new StringReader(""), new ApacheSoftwareLicense20(), subject);
        assertFalse(worker.isFinished());
        worker.read();
        assertTrue(worker.isFinished());
    }
View Full Code Here

Examples of org.apache.rat.document.MockLocation

    boolean readAndMatch(String name) throws Exception {
        File file = Resources.getResourceFile("javadocs/" + name);
        boolean result = false;
        BufferedReader in = new BufferedReader(new FileReader(file));
        String line = in.readLine();
        final Document subject = new MockLocation("subject");
        while (line != null && !result) {
            result = license.match(subject, line);
            line = in.readLine();
        }
        in.close();
View Full Code Here

Examples of org.apache.rat.document.MockLocation

        reporter = new MockClaimReporter();
    }

    @Test
    public void match() throws Exception {
        final Document subject = new MockLocation("subject");
        assertFalse("Does not match regex", license.match(subject, "Not at all"));
        assertTrue("Matches regex", license.match(subject, "This is Generated"));
    }
View Full Code Here

Examples of org.apache.rat.document.MockLocation

        assertEquals(1, licenseStringMap.entrySet().size());
    }

    @Before
    public final void initSubject() {
        this.subject = new MockLocation("subject");
    }
View Full Code Here

Examples of org.apache.rat.document.MockLocation

        final File[] resourceFiles = Resources.getResourceFiles(directory);
        if (resourceFiles.length == 0) {
            Assert.fail("No files found under "+directory);
        }
        for(File f : resourceFiles) {
            final Document subject = new MockLocation(f.toString());
            BufferedReader br = null;
            try {
                boolean result = false;
                br = Resources.getBufferedReader(f);
                String line;
View Full Code Here

Examples of org.apache.rat.document.MockLocation

    @Test
    public void match() throws Exception {
        BufferedReader in = new BufferedReader(new StringReader(HEADER));
        String line = in.readLine();
        boolean result = false;
        final Document subject = new MockLocation("subject");
        while (line != null) {
            result = license.match(subject, line);
            line = in.readLine();
        }
        assertTrue("Applied AL2.0 license should be matched", result);
View Full Code Here

Examples of org.apache.rat.document.MockLocation

    @Test
    public void noMatch() throws Exception {
        BufferedReader in = Resources.getBufferedResourceReader("elements/Source.java");
        String line = in.readLine();
        boolean result = false;
        final Document subject = new MockLocation("subject");
        while (line != null) {
            result = license.match(subject, line);
            line = in.readLine();
        }
        assertFalse("Applied AL2.0 license should not be matched", result);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.