Package com.pogofish.jadt.sink

Examples of com.pogofish.jadt.sink.StringSinkFactoryFactory


     * Make sure everything works in the happy path
     */
    @Test
    public void testHappy() {
        final JADTAntTask antTask = new JADTAntTask();
        final StringSinkFactoryFactory factory = new StringSinkFactoryFactory();       
        antTask.jadt = JADT.createDummyJADT(Collections.<SyntaxError>emptyList(), Collections.<SemanticError>emptyList(), JADT.TEST_SRC_INFO, factory);
       
        antTask.setSrcPath(JADT.TEST_SRC_INFO);
        antTask.setDestDir(JADT.TEST_DIR);
        antTask.execute();
       
        final String result = factory.results().get(JADT.TEST_DIR).get(0).getResults().get(JADT.TEST_CLASS_NAME);
        assertEquals(JADT.TEST_SRC_INFO, result);
    }
View Full Code Here


     * Make sure exceptions are handled properly
     */
    @Test
    public void testException() {
        final JADTAntTask antTask = new JADTAntTask();
        final StringSinkFactoryFactory factory = new StringSinkFactoryFactory();       
        antTask.jadt = JADT.createDummyJADT(Collections.<SyntaxError>emptyList(), Collections.<SemanticError>singletonList(SemanticError._DuplicateConstructor("whatever", "something")), JADT.TEST_SRC_INFO, factory);
       
        antTask.setSrcPath(JADT.TEST_SRC_INFO);
        antTask.setDestDir(JADT.TEST_DIR);
        try {
            antTask.execute();
           
            final String result = factory.results().get(JADT.TEST_DIR).get(0).getResults().get(JADT.TEST_CLASS_NAME);
            fail("Did not get exception, got " + result);
        } catch (BuildException e) {
            // yay
        }
    }
View Full Code Here

    /**
     * Create a dummy configged jADT based on the provided checker, send it the provided args and return the
     * resulting string (or throw the resulting exception
     */
    private String testWithDummyJADT(String[] args, List<SyntaxError> syntaxErrors, List<SemanticError> semanticErrors) {
        final StringSinkFactoryFactory factory = new StringSinkFactoryFactory();
        JADT.createDummyJADT(syntaxErrors, semanticErrors, JADT.TEST_SRC_INFO, factory).parseAndEmit(args);
        return factory.results().get(JADT.TEST_DIR).get(0).getResults().get(JADT.TEST_CLASS_NAME);
    }
View Full Code Here

    public void testHappy() throws Exception {
        final File srcFile = new File(JADT.TEST_SRC_INFO);
        final File destDir = new File(JADT.TEST_DIR);
 
        final JADTMojo mojo = new JADTMojo();
        final StringSinkFactoryFactory factory = new StringSinkFactoryFactory();       
        mojo.jadt = JADT.createDummyJADT(Collections.<SyntaxError>emptyList(), Collections.<SemanticError>emptyList(), srcFile.getCanonicalPath(), factory);
       
        mojo.setSrcPath(srcFile);
        mojo.setDestDir(destDir);
        mojo.setProject(new MavenProject());
        mojo.execute();
       
        final String result = factory.results().get(destDir.getCanonicalPath()).get(0).getResults().get(JADT.TEST_CLASS_NAME);
        assertEquals(JADT.TEST_SRC_INFO, result);
        assertEquals(1, mojo.project.getCompileSourceRoots().size());
        assertEquals(destDir.getCanonicalPath(), mojo.project.getCompileSourceRoots().get(0));
    }
View Full Code Here

    public void testException() throws Exception {
        final File srcFile = new File(JADT.TEST_SRC_INFO);
        final File destDir = new File(JADT.TEST_DIR);
       
        final JADTMojo mojo = new JADTMojo();
        final StringSinkFactoryFactory factory = new StringSinkFactoryFactory();       
        mojo.jadt = JADT.createDummyJADT(Collections.<SyntaxError>emptyList(), Collections.<SemanticError>singletonList(SemanticError._DuplicateConstructor("whatever", "something")), srcFile.getCanonicalPath(), factory);
       
        mojo.setSrcPath(srcFile);
        mojo.setDestDir(destDir);
        mojo.setProject(new MavenProject());
       
        try {
            mojo.execute();

            final String result = factory.results().get(destDir.getCanonicalPath()).get(0).getResults().get(JADT.TEST_CLASS_NAME);
            fail("Did not get exception, got " + result);
        } catch (MojoExecutionException e) {
            // yay
        }
    }
View Full Code Here

TOP

Related Classes of com.pogofish.jadt.sink.StringSinkFactoryFactory

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.