Package org.junithelper.core.file

Examples of org.junithelper.core.file.FileWriter


        try {

            // given
            File testFile = new File("src/test/java/org/junithelper/core/config/LineBreakPolicyTest.java");
            FileWriter writer = FileWriterFactory.create(testFile);
            String preparedSource = IOUtil.readAsString(IOUtil.getResourceAsStream("LineBreakPolicyTestBefore.txt"),
                    "UTF-8");
            writer.writeText(preparedSource);

            // when
            String[] args = new String[] { "src/main/java/org/junithelper/core/config/LineBreakPolicy.java" };
            System.setProperty("junithelper.skipConfirming", "true");
            System.setProperty("junithelper.configProperties",
                    "src/test/resources/junithelper-config_forceLF.properties");
            MakeTestCommand.main(args);

            // then
            Thread.sleep(100L);

            InputStream is = new FileInputStream(testFile);
            String source = IOUtil.readAsString(is, "UTF-8");
            assertThat(source.contains("\r"), is(false)); // TEST

        } finally {

            File testFile = new File("src/test/java/org/junithelper/core/config/LineBreakPolicyTest.java");
            FileWriter writer = FileWriterFactory.create(testFile);
            String preparedSource = IOUtil.readAsString(IOUtil.getResourceAsStream("LineBreakPolicyTest.txt"), "UTF-8");
            writer.writeText(preparedSource);

        }
    }
View Full Code Here


        try {

            // given
            File testFile = new File("src/test/java/org/junithelper/core/config/LineBreakPolicyTest.java");
            FileWriter writer = FileWriterFactory.create(testFile);
            String preparedSource = IOUtil.readAsString(IOUtil.getResourceAsStream("LineBreakPolicyTestBeforeLF.txt"),
                    "UTF-8");
            writer.writeText(preparedSource);

            // when
            String[] args = new String[] { "src/main/java/org/junithelper/core/config/LineBreakPolicy.java" };
            System.setProperty("junithelper.skipConfirming", "true");
            System.setProperty("junithelper.configProperties",
                    "src/test/resources/junithelper-config_forceCRLF.properties");
            MakeTestCommand.main(args);

            // then
            Thread.sleep(100L);

            InputStream is = new FileInputStream(testFile);
            String source = IOUtil.readAsString(is, "UTF-8");
            assertThat(source.contains("\r"), is(true)); // TEST

        } finally {

            File testFile = new File("src/test/java/org/junithelper/core/config/LineBreakPolicyTest.java");
            FileWriter writer = FileWriterFactory.create(testFile);
            String preparedSource = IOUtil.readAsString(IOUtil.getResourceAsStream("LineBreakPolicyTest.txt"), "UTF-8");
            writer.writeText(preparedSource);

        }
    }
View Full Code Here

        try {

            // given
            File testFile = new File("src/test/java/org/junithelper/core/config/LineBreakPolicyTest.java");
            FileWriter writer = FileWriterFactory.create(testFile);
            String preparedSource = IOUtil.readAsString(IOUtil.getResourceAsStream("LineBreakPolicyTestBefore.txt"),
                    "UTF-8");
            writer.writeText(preparedSource);

            // when
            String[] args = new String[] { "src/main/java/org/junithelper/core/config/LineBreakPolicy.java" };
            System.setProperty("junithelper.skipConfirming", "true");
            System.setProperty("junithelper.configProperties", "src/test/resources/junithelper-config.properties");
            MakeTestCommand.main(args);

            // then
            Thread.sleep(100L);

            InputStream is = new FileInputStream(testFile);
            String source = IOUtil.readAsString(is, "UTF-8");
            assertThat(source.contains("\r"), is(true)); // TEST

        } finally {

            File testFile = new File("src/test/java/org/junithelper/core/config/LineBreakPolicyTest.java");
            FileWriter writer = FileWriterFactory.create(testFile);
            String preparedSource = IOUtil.readAsString(IOUtil.getResourceAsStream("LineBreakPolicyTest.txt"), "UTF-8");
            writer.writeText(preparedSource);

        }
    }
View Full Code Here

        try {

            // given
            File testFile = new File("src/test/java/org/junithelper/core/config/LineBreakPolicyTest.java");
            FileWriter writer = FileWriterFactory.create(testFile);
            String preparedSource = IOUtil.readAsString(IOUtil.getResourceAsStream("LineBreakPolicyTestBefore.txt"),
                    "UTF-8");
            writer.writeText(preparedSource);

            // when
            String[] args = new String[] { "src/main/java/org/junithelper/core/config/LineBreakPolicy.java" };
            System.setProperty("junithelper.skipConfirming", "true");
            System.setProperty("junithelper.configProperties",
                    "src/test/resources/junithelper-config_forceNewFileLF.properties");
            MakeTestCommand.main(args);

            // then
            Thread.sleep(100L);

            InputStream is = new FileInputStream(testFile);
            String source = IOUtil.readAsString(is, "UTF-8");
            assertThat(source.contains("\r"), is(true)); // TEST

        } finally {

            File testFile = new File("src/test/java/org/junithelper/core/config/LineBreakPolicyTest.java");
            FileWriter writer = FileWriterFactory.create(testFile);
            String preparedSource = IOUtil.readAsString(IOUtil.getResourceAsStream("LineBreakPolicyTest.txt"), "UTF-8");
            writer.writeText(preparedSource);

        }
    }
View Full Code Here

        try {

            // given
            File testFile = new File("src/test/java/org/junithelper/core/generator/IndentationProviderTest.java");
            FileWriter writer = FileWriterFactory.create(testFile);
            String preparedSource = IOUtil.readAsString(
                    IOUtil.getResourceAsStream("IndentationProviderTestBefore.txt"), "UTF-8");
            writer.writeText(preparedSource);

            // when
            String[] args = new String[] { "src/main/java/org/junithelper/core/generator/IndentationProvider.java" };
            System.setProperty("junithelper.skipConfirming", "true");
            System.setProperty("junithelper.configProperties", "src/test/resources/junithelper-config.properties");
            MakeTestCommand.main(args);

            // then
            Thread.sleep(100L);

            InputStream is = new FileInputStream(testFile);
            String source = IOUtil.readAsString(is, "UTF-8");
            String expected = IOUtil.readAsString(IOUtil.getResourceAsStream("IndentationProviderTestHardTabs.txt"),
                    "UTF-8");
            assertThat(source, is(equalTo(expected))); // TEST

        } finally {

            File testFile = new File("src/test/java/org/junithelper/core/generator/IndentationProviderTest.java");
            FileWriter writer = FileWriterFactory.create(testFile);
            String preparedSource = IOUtil.readAsString(IOUtil.getResourceAsStream("IndentationProviderTestAfter.txt"),
                    "UTF-8");
            writer.writeText(preparedSource);

        }
    }
View Full Code Here

        try {

            // given
            File testFile = new File("src/test/java/org/junithelper/core/generator/IndentationProviderTest.java");
            FileWriter writer = FileWriterFactory.create(testFile);
            String preparedSource = IOUtil.readAsString(
                    IOUtil.getResourceAsStream("IndentationProviderTestBefore.txt"), "UTF-8");
            writer.writeText(preparedSource);

            // when
            String[] args = new String[] { "src/main/java/org/junithelper/core/generator/IndentationProvider.java" };
            System.setProperty("junithelper.skipConfirming", "true");
            System.setProperty("junithelper.configProperties",
                    "src/test/resources/junithelper-config_softTabs.properties");
            MakeTestCommand.main(args);

            // then
            Thread.sleep(100L);

            InputStream is = new FileInputStream(testFile);
            String source = IOUtil.readAsString(is, "UTF-8");
            String expected = IOUtil.readAsString(IOUtil
                    .getResourceAsStream("IndentationProviderTestSoftTabsSize2.txt"), "UTF-8");
            assertThat(source, is(equalTo(expected))); // TEST

        } finally {

            File testFile = new File("src/test/java/org/junithelper/core/generator/IndentationProviderTest.java");
            FileWriter writer = FileWriterFactory.create(testFile);
            String preparedSource = IOUtil.readAsString(IOUtil.getResourceAsStream("IndentationProviderTestAfter.txt"),
                    "UTF-8");
            writer.writeText(preparedSource);

        }
    }
View Full Code Here

TOP

Related Classes of org.junithelper.core.file.FileWriter

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.