test/java/time/test/java/time/format/TestCharLiteralPrinter.java

Print this page




  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 CharLiteralPrinterParser.
  70  */
  71 @Test(groups={"implementation"})
  72 public class TestCharLiteralPrinter extends AbstractTestPrinterParser {
  73 
  74     //-----------------------------------------------------------------------
  75     public void test_print_emptyCalendrical() throws Exception {
  76         buf.append("EXISTING");
  77         getFormatter('a').printTo(EMPTY_DTA, buf);
  78         assertEquals(buf.toString(), "EXISTINGa");
  79     }
  80 
  81     public void test_print_dateTime() throws Exception {
  82         buf.append("EXISTING");
  83         getFormatter('a').printTo(dta, buf);
  84         assertEquals(buf.toString(), "EXISTINGa");
  85     }
  86 
  87     public void test_print_emptyAppendable() throws Exception {
  88         getFormatter('a').printTo(dta, buf);
  89         assertEquals(buf.toString(), "a");
  90     }
  91 
  92     //-----------------------------------------------------------------------
  93     public void test_toString() throws Exception {
  94         assertEquals(getFormatter('a').toString(), "'a'");
  95     }
  96 
  97     //-----------------------------------------------------------------------
  98     public void test_toString_apos() throws Exception {
  99         assertEquals(getFormatter('\'').toString(), "''");
 100     }
 101 
 102 }


  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 CharLiteralPrinterParser.
  70  */
  71 @Test(groups={"implementation"})
  72 public class TestCharLiteralPrinter extends AbstractTestPrinterParser {
  73 
  74     //-----------------------------------------------------------------------
  75     public void test_print_emptyCalendrical() throws Exception {
  76         buf.append("EXISTING");
  77         getFormatter('a').formatTo(EMPTY_DTA, buf);
  78         assertEquals(buf.toString(), "EXISTINGa");
  79     }
  80 
  81     public void test_print_dateTime() throws Exception {
  82         buf.append("EXISTING");
  83         getFormatter('a').formatTo(dta, buf);
  84         assertEquals(buf.toString(), "EXISTINGa");
  85     }
  86 
  87     public void test_print_emptyAppendable() throws Exception {
  88         getFormatter('a').formatTo(dta, buf);
  89         assertEquals(buf.toString(), "a");
  90     }
  91 
  92     //-----------------------------------------------------------------------
  93     public void test_toString() throws Exception {
  94         assertEquals(getFormatter('a').toString(), "'a'");
  95     }
  96 
  97     //-----------------------------------------------------------------------
  98     public void test_toString_apos() throws Exception {
  99         assertEquals(getFormatter('\'').toString(), "''");
 100     }
 101 
 102 }