test/java/time/test/java/time/format/TestZoneOffsetPrinter.java

Print this page

        

@@ -57,16 +57,14 @@
  * 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 java.time.temporal.ChronoField.OFFSET_SECONDS;
 import static org.testng.Assert.assertEquals;
 
 import java.time.DateTimeException;
 import java.time.ZoneOffset;
-import java.time.format.DateTimeBuilder;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
 /**

@@ -148,28 +146,28 @@
             {"+HH:MM:SS", "-01:02:00", ZoneOffset.ofHoursMinutesSeconds(-1, -2, 0)},
         };
     }
 
     @Test(dataProvider="offsets")
-    public void test_print(String pattern, String expected, ZoneOffset offset) throws Exception {
+    public void test_format(String pattern, String expected, ZoneOffset offset) throws Exception {
         buf.append("EXISTING");
-        getFormatter(pattern, "NO-OFFSET").printTo(new DateTimeBuilder(OFFSET_SECONDS, offset.getTotalSeconds()), buf);
+        getFormatter(pattern, "NO-OFFSET").formatTo(offset, buf);
         assertEquals(buf.toString(), "EXISTING" + expected);
     }
 
     @Test(dataProvider="offsets")
     public void test_toString(String pattern, String expected, ZoneOffset offset) throws Exception {
-        assertEquals(getFormatter(pattern, "NO-OFFSET").toString(), "Offset('NO-OFFSET'," + pattern + ")");
+        assertEquals(getFormatter(pattern, "NO-OFFSET").toString(), "Offset(" + pattern + ",'NO-OFFSET')");
     }
 
     //-----------------------------------------------------------------------
     @Test(expectedExceptions=DateTimeException.class)
     public void test_print_emptyCalendrical() throws Exception {
-        getFormatter("+HH:MM:ss", "Z").printTo(EMPTY_DTA, buf);
+        getFormatter("+HH:MM:ss", "Z").formatTo(EMPTY_DTA, buf);
     }
 
     public void test_print_emptyAppendable() throws Exception {
-        getFormatter("+HH:MM:ss", "Z").printTo(new DateTimeBuilder(OFFSET_SECONDS, OFFSET_0130.getTotalSeconds()), buf);
+        getFormatter("+HH:MM:ss", "Z").formatTo(OFFSET_0130, buf);
         assertEquals(buf.toString(), "+01:30");
     }
 
 }