42 * and/or other materials provided with the distribution.
43 *
44 * * Neither the name of JSR-310 nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
49 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
50 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
51 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
52 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
53 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
54 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
55 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
56 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
57 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
58 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 */
60 package test.java.time.format;
61
62 import java.time.format.*;
63
64 import static org.testng.Assert.assertEquals;
65
66 import org.testng.annotations.Test;
67
68 /**
69 * Test StringLiteralPrinterParser.
70 */
71 @Test(groups={"implementation"})
72 public class TestStringLiteralPrinter extends AbstractTestPrinterParser {
73
74 //-----------------------------------------------------------------------
75 public void test_print_emptyCalendrical() throws Exception {
76 buf.append("EXISTING");
77 getFormatter("hello").formatTo(EMPTY_DTA, buf);
78 assertEquals(buf.toString(), "EXISTINGhello");
79 }
80
81 public void test_print_dateTime() throws Exception {
82 buf.append("EXISTING");
83 getFormatter("hello").formatTo(dta, buf);
84 assertEquals(buf.toString(), "EXISTINGhello");
85 }
86
87
88
89
90 public void test_print_emptyAppendable() throws Exception {
91 getFormatter("hello").formatTo(dta, buf);
|
42 * and/or other materials provided with the distribution.
43 *
44 * * Neither the name of JSR-310 nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
49 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
50 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
51 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
52 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
53 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
54 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
55 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
56 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
57 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
58 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 */
60 package test.java.time.format;
61
62 import static org.testng.Assert.assertEquals;
63
64 import org.testng.annotations.Test;
65
66 /**
67 * Test StringLiteralPrinterParser.
68 */
69 @Test
70 public class TestStringLiteralPrinter extends AbstractTestPrinterParser {
71
72 //-----------------------------------------------------------------------
73 public void test_print_emptyCalendrical() throws Exception {
74 buf.append("EXISTING");
75 getFormatter("hello").formatTo(EMPTY_DTA, buf);
76 assertEquals(buf.toString(), "EXISTINGhello");
77 }
78
79 public void test_print_dateTime() throws Exception {
80 buf.append("EXISTING");
81 getFormatter("hello").formatTo(dta, buf);
82 assertEquals(buf.toString(), "EXISTINGhello");
83 }
84
85
86
87
88 public void test_print_emptyAppendable() throws Exception {
89 getFormatter("hello").formatTo(dta, buf);
|