< prev index next >

test/java/time/tck/java/time/chrono/TCKHijrahChronology.java

Print this page


   1 /*
   2  * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 532     private static HijrahDate date(int y, int m, int d) {
 533         return HijrahDate.of(y, m, d);
 534     }
 535 
 536     private static HijrahDate dateYearDay(int y, int doy) {
 537         return HijrahChronology.INSTANCE.dateYearDay(y, doy);
 538     }
 539 
 540     //-----------------------------------------------------------------------
 541     // equals()
 542     //-----------------------------------------------------------------------
 543     @Test
 544     public void test_equals_true() {
 545         assertTrue(HijrahChronology.INSTANCE.equals(HijrahChronology.INSTANCE));
 546     }
 547 
 548     @Test
 549     public void test_equals_false() {
 550         assertFalse(HijrahChronology.INSTANCE.equals(IsoChronology.INSTANCE));
 551     }




























 552 }
   1 /*
   2  * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 532     private static HijrahDate date(int y, int m, int d) {
 533         return HijrahDate.of(y, m, d);
 534     }
 535 
 536     private static HijrahDate dateYearDay(int y, int doy) {
 537         return HijrahChronology.INSTANCE.dateYearDay(y, doy);
 538     }
 539 
 540     //-----------------------------------------------------------------------
 541     // equals()
 542     //-----------------------------------------------------------------------
 543     @Test
 544     public void test_equals_true() {
 545         assertTrue(HijrahChronology.INSTANCE.equals(HijrahChronology.INSTANCE));
 546     }
 547 
 548     @Test
 549     public void test_equals_false() {
 550         assertFalse(HijrahChronology.INSTANCE.equals(IsoChronology.INSTANCE));
 551     }
 552 
 553     @DataProvider(name="alignedDayOfWeekInMonthTestDates")
 554     Object[][] data_alignedDayOfWeekInMonth() {
 555         return new Object[][] {
 556             {1437, 9, 1, 1, 1},  //Monday is the 1st day of Month
 557             {1437, 10, 1, 1, 1}, //Any Other day is the 1st day of month
 558             {1437, 10, 11, 2, 31},
 559             {1437, 10, 29, 5, 1},
 560         };
 561     }
 562     
 563     //-----------------------------------------------------------------------
 564     // Test for aligned-week-of-month calculation based on the day-of-month
 565     //-----------------------------------------------------------------------
 566     @Test(dataProvider="alignedDayOfWeekInMonthTestDates")
 567     public void test_alignedWeekOfMonth(int year, int month, int dom, int wom, int dowm) {
 568         HijrahDate date = HijrahChronology.INSTANCE.date(year, month, dom);
 569         assertEquals(date.getLong(ChronoField.ALIGNED_WEEK_OF_MONTH), wom);
 570     }
 571 
 572     //-----------------------------------------------------------------------
 573     // Test for aligned-day-of-week calculation based on the day-of-month
 574     //-----------------------------------------------------------------------
 575     @Test(dataProvider="alignedDayOfWeekInMonthTestDates")
 576     public void test_alignedDayOfWeekInMonth(int year, int month, int dom, int wom, int dowm) {
 577         HijrahDate date = HijrahChronology.INSTANCE.date(year, month, dom);
 578         assertEquals(date.getLong(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), dowm);
 579     }
 580 }
< prev index next >