test/java/time/tck/java/time/chrono/TCKChronology.java

Print this page




 130     }
 131 
 132     @Test
 133     public void test_calendar_list() {
 134         Set<Chronology> chronos = Chronology.getAvailableChronologies();
 135         assertNotNull(chronos, "Required list of calendars must be non-null");
 136         for (Chronology chrono : chronos) {
 137             Chronology lookup = Chronology.of(chrono.getId());
 138             assertNotNull(lookup, "Required calendar not found: " + chrono);
 139         }
 140         assertEquals(chronos.size() >= data_of_calendars().length, true, "Chronology.getAvailableChronologies().size = " + chronos.size()
 141                 + ", expected >= " + data_of_calendars().length);
 142     }
 143 
 144     //-----------------------------------------------------------------------
 145     // getDisplayName()
 146     //-----------------------------------------------------------------------
 147     @DataProvider(name = "calendarDisplayName")
 148     Object[][] data_of_calendarDisplayNames() {
 149         return new Object[][] {
 150                     {"Hijrah", "Islamic Umm al-Qura Calendar"},
 151                     {"ISO", "ISO"},
 152                     {"Japanese", "Japanese Calendar"},
 153                     {"Minguo", "Minguo Calendar"},
 154                     {"ThaiBuddhist", "Buddhist Calendar"},
 155                 };
 156     }
 157 
 158     @Test(dataProvider = "calendarDisplayName")
 159     public void test_getDisplayName(String chronoId, String calendarDisplayName) {
 160         Chronology chrono = Chronology.of(chronoId);
 161         assertEquals(chrono.getDisplayName(TextStyle.FULL, Locale.ENGLISH), calendarDisplayName);
 162     }
 163 
 164     /**
 165      * Compute the number of days from the Epoch and compute the date from the number of days.
 166      */
 167     @Test(dataProvider = "calendarNameAndType")
 168     public void test_epoch(String name, String alias) {
 169         Chronology chrono = Chronology.of(name); // a chronology. In practice this is rarely hardcoded
 170         ChronoLocalDate date1 = chrono.dateNow();




 130     }
 131 
 132     @Test
 133     public void test_calendar_list() {
 134         Set<Chronology> chronos = Chronology.getAvailableChronologies();
 135         assertNotNull(chronos, "Required list of calendars must be non-null");
 136         for (Chronology chrono : chronos) {
 137             Chronology lookup = Chronology.of(chrono.getId());
 138             assertNotNull(lookup, "Required calendar not found: " + chrono);
 139         }
 140         assertEquals(chronos.size() >= data_of_calendars().length, true, "Chronology.getAvailableChronologies().size = " + chronos.size()
 141                 + ", expected >= " + data_of_calendars().length);
 142     }
 143 
 144     //-----------------------------------------------------------------------
 145     // getDisplayName()
 146     //-----------------------------------------------------------------------
 147     @DataProvider(name = "calendarDisplayName")
 148     Object[][] data_of_calendarDisplayNames() {
 149         return new Object[][] {
 150                     {"Hijrah", "Islamic Calendar (Umm al-Qura)"},
 151                     {"ISO", "ISO"},
 152                     {"Japanese", "Japanese Calendar"},
 153                     {"Minguo", "Minguo Calendar"},
 154                     {"ThaiBuddhist", "Buddhist Calendar"},
 155                 };
 156     }
 157 
 158     @Test(dataProvider = "calendarDisplayName")
 159     public void test_getDisplayName(String chronoId, String calendarDisplayName) {
 160         Chronology chrono = Chronology.of(chronoId);
 161         assertEquals(chrono.getDisplayName(TextStyle.FULL, Locale.ENGLISH), calendarDisplayName);
 162     }
 163 
 164     /**
 165      * Compute the number of days from the Epoch and compute the date from the number of days.
 166      */
 167     @Test(dataProvider = "calendarNameAndType")
 168     public void test_epoch(String name, String alias) {
 169         Chronology chrono = Chronology.of(name); // a chronology. In practice this is rarely hardcoded
 170         ChronoLocalDate date1 = chrono.dateNow();