Package refutils

Examples of refutils.ReflectionHelper


                    return new UnsortedWrapper<T>(content);
                }

            };
        } else {
            new ReflectionHelper(wrapperFactory).setField(fileUtil);
        }
        new ReflectionHelper(xmlProcessor).setField(wrapperFactory);
        xmlProcessor.setOriginalXml(new ByteArrayInputStream(xml.getBytes(UTF_8)));
        return xmlProcessor;
    }
View Full Code Here


        fileUtil.savePomFile(null);
    }

    private FileUtil createFileUtil() throws NoSuchFieldException, IllegalAccessException {
        ReflectionHelper helper = new ReflectionHelper(originalFileUtil);
        helper.setField("backupFile", backupFileMock);
        helper.setField("pomFile", pomFileMock);
        helper.setField("newName", "backupFileName");
        return spy(originalFileUtil);
    }
View Full Code Here

    public ExpectedException expectedException = ExpectedException.none();

    @Before
    public void setup() throws IllegalAccessException, NoSuchFieldException {
        verifyMojo = new VerifyMojo();
        ReflectionHelper mojoHelper = new ReflectionHelper(verifyMojo);
        mojoHelper.setField(sortPom);
        mojoHelper.setField("lineSeparator", "\n");
        mojoHelper.setField("verifyFail", "SORT");
    }
View Full Code Here

        verifyMojo.setup();
    }

    @Test
    public void skipParameterShouldSkipExecution() throws Exception {
        new ReflectionHelper(verifyMojo).setField("skip", true);

        verifyMojo.execute();
       
        verifyNoMoreInteractions(sortPom);
    }
View Full Code Here

    public ExpectedException expectedException = ExpectedException.none();

    @Before
    public void setup() throws IllegalAccessException, NoSuchFieldException {
        sortMojo = new SortMojo();
        ReflectionHelper mojoHelper = new ReflectionHelper(sortMojo);
        mojoHelper.setField(sortPom);
        mojoHelper.setField("lineSeparator", "\n");
    }
View Full Code Here

        sortMojo.setup();
    }

    @Test
    public void skipParameterShouldSkipExecution() throws Exception {
        new ReflectionHelper(sortMojo).setField("skip", true);

        sortMojo.execute();
       
        verifyNoMoreInteractions(sortPom);
    }
View Full Code Here

    @Before
    public void setup() throws SecurityException, IllegalArgumentException, NoSuchFieldException,
            IllegalAccessException, MojoFailureException {
        verifyMojo = new VerifyMojo();
        new ReflectionHelper(verifyMojo).setField("lineSeparator", "\n");
        new ReflectionHelper(verifyMojo).setField("encoding", "UTF-8");
        new ReflectionHelper(verifyMojo).setField("verifyFail", "SORT");

        sortPomImpl = new ReflectionHelper(verifyMojo).getField(SortPomImpl.class);
        fileUtil = new ReflectionHelper(sortPomImpl).getField(FileUtil.class);
        xmlProcessor = new ReflectionHelper(sortPomImpl).getField(XmlProcessor.class);
        WrapperFactoryImpl wrapperFactoryImpl = new ReflectionHelper(sortPomImpl).getField(WrapperFactoryImpl.class);
        elementWrapperCreator = new ReflectionHelper(wrapperFactoryImpl).getField(ElementWrapperCreator.class);
        textWrapperCreator = new ReflectionHelper(wrapperFactoryImpl).getField(TextWrapperCreator.class);
    }
View Full Code Here

    @Test
    public void lineSeparatorParameter() throws Exception {
        testParameterMoveFromMojoToRestOfApplication("lineSeparator", "\r");

        assertEquals("\r", new ReflectionHelper(xmlProcessor).getField("lineSeparatorUtil").toString());
    }
View Full Code Here

    @Test
    public void parameterNrOfIndentSpaceShouldEndUpInXmlProcessor() throws Exception {
        testParameterMoveFromMojoToRestOfApplication("nrOfIndentSpace", 6);

        assertEquals("      ", new ReflectionHelper(xmlProcessor).getField("indentCharacters"));
    }
View Full Code Here

    @Test
    public void parameterSortOrderFileShouldEndUpInFileUtil() throws Exception {
        testParameterMoveFromMojoToRestOfApplication("sortOrderFile", "sortOrderFile.gurka");

        Object actual = new ReflectionHelper(fileUtil).getField("customSortOrderFile");
        assertEquals("sortOrderFile.gurka", actual);
    }
View Full Code Here

TOP

Related Classes of refutils.ReflectionHelper

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.