< prev index next >

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

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -547,6 +547,34 @@
 
     @Test
     public void test_equals_false() {
         assertFalse(HijrahChronology.INSTANCE.equals(IsoChronology.INSTANCE));
     }
+
+    @DataProvider(name="alignedDayOfWeekInMonthTestDates")
+    Object[][] data_alignedDayOfWeekInMonth() {
+        return new Object[][] {
+            {1437, 9, 1, 1, 1},  //Monday is the 1st day of Month
+            {1437, 10, 1, 1, 1}, //Any Other day is the 1st day of month
+            {1437, 10, 11, 2, 31},
+            {1437, 10, 29, 5, 1},
+        };
+    }
+    
+    //-----------------------------------------------------------------------
+    // Test for aligned-week-of-month calculation based on the day-of-month
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="alignedDayOfWeekInMonthTestDates")
+    public void test_alignedWeekOfMonth(int year, int month, int dom, int wom, int dowm) {
+        HijrahDate date = HijrahChronology.INSTANCE.date(year, month, dom);
+        assertEquals(date.getLong(ChronoField.ALIGNED_WEEK_OF_MONTH), wom);
+    }
+
+    //-----------------------------------------------------------------------
+    // Test for aligned-day-of-week calculation based on the day-of-month
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="alignedDayOfWeekInMonthTestDates")
+    public void test_alignedDayOfWeekInMonth(int year, int month, int dom, int wom, int dowm) {
+        HijrahDate date = HijrahChronology.INSTANCE.date(year, month, dom);
+        assertEquals(date.getLong(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), dowm);
+    }
 }
< prev index next >