test/java/time/test/java/time/format/TestPadPrinterDecorator.java

Print this page

        

*** 57,70 **** * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package test.java.time.format; - import java.time.format.*; - import static org.testng.Assert.assertEquals; import java.time.LocalDate; import org.testng.annotations.Test; /** --- 57,69 ---- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package test.java.time.format; import static org.testng.Assert.assertEquals; + import java.time.DateTimeException; import java.time.LocalDate; import org.testng.annotations.Test; /**
*** 74,129 **** public class TestPadPrinterDecorator extends AbstractTestPrinterParser { //----------------------------------------------------------------------- public void test_print_emptyCalendrical() throws Exception { builder.padNext(3, '-').appendLiteral('Z'); ! getFormatter().printTo(EMPTY_DTA, buf); assertEquals(buf.toString(), "--Z"); } public void test_print_fullDateTime() throws Exception { builder.padNext(3, '-').appendLiteral('Z'); ! getFormatter().printTo(LocalDate.of(2008, 12, 3), buf); assertEquals(buf.toString(), "--Z"); } public void test_print_append() throws Exception { buf.append("EXISTING"); builder.padNext(3, '-').appendLiteral('Z'); ! getFormatter().printTo(EMPTY_DTA, buf); assertEquals(buf.toString(), "EXISTING--Z"); } //----------------------------------------------------------------------- public void test_print_noPadRequiredSingle() throws Exception { builder.padNext(1, '-').appendLiteral('Z'); ! getFormatter().printTo(EMPTY_DTA, buf); assertEquals(buf.toString(), "Z"); } public void test_print_padRequiredSingle() throws Exception { builder.padNext(5, '-').appendLiteral('Z'); ! getFormatter().printTo(EMPTY_DTA, buf); assertEquals(buf.toString(), "----Z"); } public void test_print_noPadRequiredMultiple() throws Exception { builder.padNext(4, '-').appendLiteral("WXYZ"); ! getFormatter().printTo(EMPTY_DTA, buf); assertEquals(buf.toString(), "WXYZ"); } public void test_print_padRequiredMultiple() throws Exception { builder.padNext(5, '-').appendLiteral("WXYZ"); ! getFormatter().printTo(EMPTY_DTA, buf); assertEquals(buf.toString(), "-WXYZ"); } ! @Test(expectedExceptions=DateTimePrintException.class) public void test_print_overPad() throws Exception { builder.padNext(3, '-').appendLiteral("WXYZ"); ! getFormatter().printTo(EMPTY_DTA, buf); } //----------------------------------------------------------------------- public void test_toString1() throws Exception { builder.padNext(5, ' ').appendLiteral('Y'); --- 73,128 ---- public class TestPadPrinterDecorator extends AbstractTestPrinterParser { //----------------------------------------------------------------------- public void test_print_emptyCalendrical() throws Exception { builder.padNext(3, '-').appendLiteral('Z'); ! getFormatter().formatTo(EMPTY_DTA, buf); assertEquals(buf.toString(), "--Z"); } public void test_print_fullDateTime() throws Exception { builder.padNext(3, '-').appendLiteral('Z'); ! getFormatter().formatTo(LocalDate.of(2008, 12, 3), buf); assertEquals(buf.toString(), "--Z"); } public void test_print_append() throws Exception { buf.append("EXISTING"); builder.padNext(3, '-').appendLiteral('Z'); ! getFormatter().formatTo(EMPTY_DTA, buf); assertEquals(buf.toString(), "EXISTING--Z"); } //----------------------------------------------------------------------- public void test_print_noPadRequiredSingle() throws Exception { builder.padNext(1, '-').appendLiteral('Z'); ! getFormatter().formatTo(EMPTY_DTA, buf); assertEquals(buf.toString(), "Z"); } public void test_print_padRequiredSingle() throws Exception { builder.padNext(5, '-').appendLiteral('Z'); ! getFormatter().formatTo(EMPTY_DTA, buf); assertEquals(buf.toString(), "----Z"); } public void test_print_noPadRequiredMultiple() throws Exception { builder.padNext(4, '-').appendLiteral("WXYZ"); ! getFormatter().formatTo(EMPTY_DTA, buf); assertEquals(buf.toString(), "WXYZ"); } public void test_print_padRequiredMultiple() throws Exception { builder.padNext(5, '-').appendLiteral("WXYZ"); ! getFormatter().formatTo(EMPTY_DTA, buf); assertEquals(buf.toString(), "-WXYZ"); } ! @Test(expectedExceptions=DateTimeException.class) public void test_print_overPad() throws Exception { builder.padNext(3, '-').appendLiteral("WXYZ"); ! getFormatter().formatTo(EMPTY_DTA, buf); } //----------------------------------------------------------------------- public void test_toString1() throws Exception { builder.padNext(5, ' ').appendLiteral('Y');