Package java.io

Examples of java.io.PrintStream.format()


    /**
     * @tests java.io.PrintStream#format(java.lang.String, java.lang.Object...)
     */
    public void test_formatLjava_lang_String$Ljava_lang_Object() {
        PrintStream os = new PrintStream(bos, false);
        os.format("%s %s", "Hello", "World");
        os.flush();
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        byte[] rbytes = new byte[11];
        bis.read(rbytes, 0, rbytes.length);
        assertEquals("Wrote incorrect string", "Hello World",
View Full Code Here


     * @tests java.io.PrintStream#format(java.util.Locale, java.lang.String,
     *        java.lang.Object...)
     */
    public void test_formatLjava_util_Locale_Ljava_lang_String_$Ljava_lang_Object() {
        PrintStream os = new PrintStream(bos, false);
        os.format(Locale.US, "%s %s", "Hello", "World");
        os.flush();
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        byte[] rbytes = new byte[11];
        bis.read(rbytes, 0, rbytes.length);
        assertEquals("Wrote incorrect string", "Hello World",
View Full Code Here

        try {
            FileOutputStream fout = new FileOutputStream(outputLocation + ".tmp");
            PrintStream pout = new PrintStream(fout);
            if ("text".equals(mode)) {
                for (FoundTest foundTest: foundTests) {
                    pout.format("%s:%s\n", foundTest.componentName, foundTest.suiteName);
                }
            } else if ("ant".equals(mode)) {
                pout.println("<project default=\"all-tests\">");
                pout.print(" <target name=\"all-tests\" depends=\"");
                for (int i = 0; i < foundTests.size(); i++) {
View Full Code Here

                pout.println("<project default=\"all-tests\">");
                pout.print(" <target name=\"all-tests\" depends=\"");
                for (int i = 0; i < foundTests.size(); i++) {
                    if (i != 0) pout.print(',');
                    FoundTest foundTest = foundTests.get(i);
                    pout.format("%s:%s", foundTest.componentName, foundTest.suiteName);
                }
                pout.println("\"/>\n");
                for (int i = 0; i < foundTests.size(); i++) {
                    FoundTest foundTest = foundTests.get(i);
                    pout.format(" <target name=\"%1$s:%2$s\">\n  <ant antfile=\"build.xml\" target=\"run-single-test-suite\">\n   <property name=\"test.component\" value=\"%1$s\"/>\n   <property name=\"test.suiteName\" value=\"%2$s\"/>\n  </ant>\n </target>\n", foundTest.componentName, foundTest.suiteName);
View Full Code Here

                    pout.format("%s:%s", foundTest.componentName, foundTest.suiteName);
                }
                pout.println("\"/>\n");
                for (int i = 0; i < foundTests.size(); i++) {
                    FoundTest foundTest = foundTests.get(i);
                    pout.format(" <target name=\"%1$s:%2$s\">\n  <ant antfile=\"build.xml\" target=\"run-single-test-suite\">\n   <property name=\"test.component\" value=\"%1$s\"/>\n   <property name=\"test.suiteName\" value=\"%2$s\"/>\n  </ant>\n </target>\n", foundTest.componentName, foundTest.suiteName);
                }
                pout.println("</project>");
            }
            pout.close();
            fout.close();
View Full Code Here

    /**
     * @tests java.io.PrintStream#format(java.lang.String, java.lang.Object...)
     */
    public void test_formatLjava_lang_String$Ljava_lang_Object() {
        PrintStream os = new PrintStream(bos, false);
        os.format("%s %s", "Hello", "World");
        os.flush();
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        byte[] rbytes = new byte[11];
        bis.read(rbytes, 0, rbytes.length);
        assertEquals("Wrote incorrect string", "Hello World",
View Full Code Here

     * @tests java.io.PrintStream#format(java.util.Locale, java.lang.String,
     *        java.lang.Object...)
     */
    public void test_formatLjava_util_Locale_Ljava_lang_String_$Ljava_lang_Object() {
        PrintStream os = new PrintStream(bos, false);
        os.format(Locale.US, "%s %s", "Hello", "World");
        os.flush();
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        byte[] rbytes = new byte[11];
        bis.read(rbytes, 0, rbytes.length);
        assertEquals("Wrote incorrect string", "Hello World",
View Full Code Here

        try {
            FileOutputStream fout = new FileOutputStream(outputLocation + ".tmp");
            PrintStream pout = new PrintStream(fout);
            if ("text".equals(mode)) {
                for (FoundTest foundTest: foundTests) {
                    pout.format("%s:%s\n", foundTest.componentName, foundTest.suiteName);
                }
            } else if ("ant".equals(mode)) {
                pout.println("<project default=\"all-tests\">");
                pout.print(" <target name=\"all-tests\" depends=\"");
                for (int i = 0; i < foundTests.size(); i++) {
View Full Code Here

                pout.println("<project default=\"all-tests\">");
                pout.print(" <target name=\"all-tests\" depends=\"");
                for (int i = 0; i < foundTests.size(); i++) {
                    if (i != 0) pout.print(',');
                    FoundTest foundTest = foundTests.get(i);
                    pout.format("%s:%s", foundTest.componentName, foundTest.suiteName);
                }
                pout.println("\"/>\n");
                for (int i = 0; i < foundTests.size(); i++) {
                    FoundTest foundTest = foundTests.get(i);
                    pout.format(" <target name=\"%1$s:%2$s\">\n  <ant antfile=\"build.xml\" target=\"run-single-test-suite\">\n   <property name=\"test.component\" value=\"%1$s\"/>\n   <property name=\"test.suiteName\" value=\"%2$s\"/>\n  </ant>\n </target>\n", foundTest.componentName, foundTest.suiteName);
View Full Code Here

                    pout.format("%s:%s", foundTest.componentName, foundTest.suiteName);
                }
                pout.println("\"/>\n");
                for (int i = 0; i < foundTests.size(); i++) {
                    FoundTest foundTest = foundTests.get(i);
                    pout.format(" <target name=\"%1$s:%2$s\">\n  <ant antfile=\"build.xml\" target=\"run-single-test-suite\">\n   <property name=\"test.component\" value=\"%1$s\"/>\n   <property name=\"test.suiteName\" value=\"%2$s\"/>\n  </ant>\n </target>\n", foundTest.componentName, foundTest.suiteName);
                }
                pout.println("</project>");
            }
            pout.close();
            fout.close();
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.