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. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * This file is available under and governed by the GNU General Public 26 * License version 2 only, as published by the Free Software Foundation. 27 * However, the following notice accompanied the original version of this 28 * file: 29 * 30 * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos 31 * 32 * All rights reserved. 33 * 34 * Redistribution and use in source and binary forms, with or without 35 * modification, are permitted provided that the following conditions are met: 36 * 37 * * Redistributions of source code must retain the above copyright notice, 38 * this list of conditions and the following disclaimer. 39 * 40 * * Redistributions in binary form must reproduce the above copyright notice, 41 * this list of conditions and the following disclaimer in the documentation 42 * and/or other materials provided with the distribution. 43 * 44 * * Neither the name of JSR-310 nor the names of its contributors 45 * may be used to endorse or promote products derived from this software 46 * without specific prior written permission. 47 * 48 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 49 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 50 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 51 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 52 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 53 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 54 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 55 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 56 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 57 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 58 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 59 */ 60 package tck.java.time; 61 62 import static java.time.temporal.ChronoField.MONTH_OF_YEAR; 63 import static org.testng.Assert.assertEquals; 64 65 import java.time.DateTimeException; 66 import java.time.LocalDate; 67 import java.time.LocalTime; 68 import java.time.Month; 69 import java.time.chrono.IsoChronology; 70 import java.time.format.TextStyle; 71 import java.time.temporal.ChronoField; 72 import java.time.temporal.ChronoUnit; 73 import java.time.temporal.JulianFields; 74 import java.time.temporal.TemporalAccessor; 75 import java.time.temporal.TemporalField; 76 import java.time.temporal.TemporalQueries; 77 import java.time.temporal.TemporalQuery; 78 import java.util.ArrayList; 79 import java.util.Arrays; 80 import java.util.List; 81 import java.util.Locale; 82 83 import org.testng.annotations.DataProvider; 84 import org.testng.annotations.Test; 85 86 /** 87 * Test Month. 88 */ 89 @Test 90 public class TCKMonth extends AbstractDateTimeTest { 91 92 private static final int MAX_LENGTH = 12; 93 94 //----------------------------------------------------------------------- 95 @Override samples()96 protected List<TemporalAccessor> samples() { 97 TemporalAccessor[] array = {Month.JANUARY, Month.JUNE, Month.DECEMBER, }; 98 return Arrays.asList(array); 99 } 100 101 @Override validFields()102 protected List<TemporalField> validFields() { 103 TemporalField[] array = { 104 MONTH_OF_YEAR, 105 }; 106 return Arrays.asList(array); 107 } 108 109 @Override invalidFields()110 protected List<TemporalField> invalidFields() { 111 List<TemporalField> list = new ArrayList<>(Arrays.<TemporalField>asList(ChronoField.values())); 112 list.removeAll(validFields()); 113 list.add(JulianFields.JULIAN_DAY); 114 list.add(JulianFields.MODIFIED_JULIAN_DAY); 115 list.add(JulianFields.RATA_DIE); 116 return list; 117 } 118 119 //----------------------------------------------------------------------- 120 @Test test_factory_int_singleton()121 public void test_factory_int_singleton() { 122 for (int i = 1; i <= MAX_LENGTH; i++) { 123 Month test = Month.of(i); 124 assertEquals(test.getValue(), i); 125 } 126 } 127 128 @Test(expectedExceptions=DateTimeException.class) test_factory_int_tooLow()129 public void test_factory_int_tooLow() { 130 Month.of(0); 131 } 132 133 @Test(expectedExceptions=DateTimeException.class) test_factory_int_tooHigh()134 public void test_factory_int_tooHigh() { 135 Month.of(13); 136 } 137 138 //----------------------------------------------------------------------- 139 @Test test_factory_CalendricalObject()140 public void test_factory_CalendricalObject() { 141 assertEquals(Month.from(LocalDate.of(2011, 6, 6)), Month.JUNE); 142 } 143 144 @Test(expectedExceptions=DateTimeException.class) test_factory_CalendricalObject_invalid_noDerive()145 public void test_factory_CalendricalObject_invalid_noDerive() { 146 Month.from(LocalTime.of(12, 30)); 147 } 148 149 @Test(expectedExceptions=NullPointerException.class) test_factory_CalendricalObject_null()150 public void test_factory_CalendricalObject_null() { 151 Month.from((TemporalAccessor) null); 152 } 153 154 //----------------------------------------------------------------------- 155 // isSupported(TemporalField) 156 //----------------------------------------------------------------------- 157 @Test test_isSupported_TemporalField()158 public void test_isSupported_TemporalField() { 159 assertEquals(Month.AUGUST.isSupported((TemporalField) null), false); 160 assertEquals(Month.AUGUST.isSupported(ChronoField.NANO_OF_SECOND), false); 161 assertEquals(Month.AUGUST.isSupported(ChronoField.NANO_OF_DAY), false); 162 assertEquals(Month.AUGUST.isSupported(ChronoField.MICRO_OF_SECOND), false); 163 assertEquals(Month.AUGUST.isSupported(ChronoField.MICRO_OF_DAY), false); 164 assertEquals(Month.AUGUST.isSupported(ChronoField.MILLI_OF_SECOND), false); 165 assertEquals(Month.AUGUST.isSupported(ChronoField.MILLI_OF_DAY), false); 166 assertEquals(Month.AUGUST.isSupported(ChronoField.SECOND_OF_MINUTE), false); 167 assertEquals(Month.AUGUST.isSupported(ChronoField.SECOND_OF_DAY), false); 168 assertEquals(Month.AUGUST.isSupported(ChronoField.MINUTE_OF_HOUR), false); 169 assertEquals(Month.AUGUST.isSupported(ChronoField.MINUTE_OF_DAY), false); 170 assertEquals(Month.AUGUST.isSupported(ChronoField.HOUR_OF_AMPM), false); 171 assertEquals(Month.AUGUST.isSupported(ChronoField.CLOCK_HOUR_OF_AMPM), false); 172 assertEquals(Month.AUGUST.isSupported(ChronoField.HOUR_OF_DAY), false); 173 assertEquals(Month.AUGUST.isSupported(ChronoField.CLOCK_HOUR_OF_DAY), false); 174 assertEquals(Month.AUGUST.isSupported(ChronoField.AMPM_OF_DAY), false); 175 assertEquals(Month.AUGUST.isSupported(ChronoField.DAY_OF_WEEK), false); 176 assertEquals(Month.AUGUST.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), false); 177 assertEquals(Month.AUGUST.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), false); 178 assertEquals(Month.AUGUST.isSupported(ChronoField.DAY_OF_MONTH), false); 179 assertEquals(Month.AUGUST.isSupported(ChronoField.DAY_OF_YEAR), false); 180 assertEquals(Month.AUGUST.isSupported(ChronoField.EPOCH_DAY), false); 181 assertEquals(Month.AUGUST.isSupported(ChronoField.ALIGNED_WEEK_OF_MONTH), false); 182 assertEquals(Month.AUGUST.isSupported(ChronoField.ALIGNED_WEEK_OF_YEAR), false); 183 assertEquals(Month.AUGUST.isSupported(ChronoField.MONTH_OF_YEAR), true); 184 assertEquals(Month.AUGUST.isSupported(ChronoField.PROLEPTIC_MONTH), false); 185 assertEquals(Month.AUGUST.isSupported(ChronoField.YEAR), false); 186 assertEquals(Month.AUGUST.isSupported(ChronoField.YEAR_OF_ERA), false); 187 assertEquals(Month.AUGUST.isSupported(ChronoField.ERA), false); 188 assertEquals(Month.AUGUST.isSupported(ChronoField.INSTANT_SECONDS), false); 189 assertEquals(Month.AUGUST.isSupported(ChronoField.OFFSET_SECONDS), false); 190 } 191 192 //----------------------------------------------------------------------- 193 // get(TemporalField) 194 //----------------------------------------------------------------------- 195 @Test test_get_TemporalField()196 public void test_get_TemporalField() { 197 assertEquals(Month.JULY.get(ChronoField.MONTH_OF_YEAR), 7); 198 } 199 200 @Test test_getLong_TemporalField()201 public void test_getLong_TemporalField() { 202 assertEquals(Month.JULY.getLong(ChronoField.MONTH_OF_YEAR), 7); 203 } 204 205 //----------------------------------------------------------------------- 206 // query(TemporalQuery) 207 //----------------------------------------------------------------------- 208 @DataProvider(name="query") data_query()209 Object[][] data_query() { 210 return new Object[][] { 211 {Month.JUNE, TemporalQueries.chronology(), IsoChronology.INSTANCE}, 212 {Month.JUNE, TemporalQueries.zoneId(), null}, 213 {Month.JUNE, TemporalQueries.precision(), ChronoUnit.MONTHS}, 214 {Month.JUNE, TemporalQueries.zone(), null}, 215 {Month.JUNE, TemporalQueries.offset(), null}, 216 {Month.JUNE, TemporalQueries.localDate(), null}, 217 {Month.JUNE, TemporalQueries.localTime(), null}, 218 }; 219 } 220 221 @Test(dataProvider="query") test_query(TemporalAccessor temporal, TemporalQuery<T> query, T expected)222 public <T> void test_query(TemporalAccessor temporal, TemporalQuery<T> query, T expected) { 223 assertEquals(temporal.query(query), expected); 224 } 225 226 @Test(dataProvider="query") test_queryFrom(TemporalAccessor temporal, TemporalQuery<T> query, T expected)227 public <T> void test_queryFrom(TemporalAccessor temporal, TemporalQuery<T> query, T expected) { 228 assertEquals(query.queryFrom(temporal), expected); 229 } 230 231 @Test(expectedExceptions=NullPointerException.class) test_query_null()232 public void test_query_null() { 233 Month.JUNE.query(null); 234 } 235 236 //----------------------------------------------------------------------- 237 // getText() 238 //----------------------------------------------------------------------- 239 @Test test_getText()240 public void test_getText() { 241 assertEquals(Month.JANUARY.getDisplayName(TextStyle.SHORT, Locale.US), "Jan"); 242 } 243 244 @Test(expectedExceptions = NullPointerException.class) test_getText_nullStyle()245 public void test_getText_nullStyle() { 246 Month.JANUARY.getDisplayName(null, Locale.US); 247 } 248 249 @Test(expectedExceptions = NullPointerException.class) test_getText_nullLocale()250 public void test_getText_nullLocale() { 251 Month.JANUARY.getDisplayName(TextStyle.FULL, null); 252 } 253 254 //----------------------------------------------------------------------- 255 // plus(long), plus(long,unit) 256 //----------------------------------------------------------------------- 257 @DataProvider(name="plus") data_plus()258 Object[][] data_plus() { 259 return new Object[][] { 260 {1, -13, 12}, 261 {1, -12, 1}, 262 {1, -11, 2}, 263 {1, -10, 3}, 264 {1, -9, 4}, 265 {1, -8, 5}, 266 {1, -7, 6}, 267 {1, -6, 7}, 268 {1, -5, 8}, 269 {1, -4, 9}, 270 {1, -3, 10}, 271 {1, -2, 11}, 272 {1, -1, 12}, 273 {1, 0, 1}, 274 {1, 1, 2}, 275 {1, 2, 3}, 276 {1, 3, 4}, 277 {1, 4, 5}, 278 {1, 5, 6}, 279 {1, 6, 7}, 280 {1, 7, 8}, 281 {1, 8, 9}, 282 {1, 9, 10}, 283 {1, 10, 11}, 284 {1, 11, 12}, 285 {1, 12, 1}, 286 {1, 13, 2}, 287 288 {1, 1, 2}, 289 {2, 1, 3}, 290 {3, 1, 4}, 291 {4, 1, 5}, 292 {5, 1, 6}, 293 {6, 1, 7}, 294 {7, 1, 8}, 295 {8, 1, 9}, 296 {9, 1, 10}, 297 {10, 1, 11}, 298 {11, 1, 12}, 299 {12, 1, 1}, 300 301 {1, -1, 12}, 302 {2, -1, 1}, 303 {3, -1, 2}, 304 {4, -1, 3}, 305 {5, -1, 4}, 306 {6, -1, 5}, 307 {7, -1, 6}, 308 {8, -1, 7}, 309 {9, -1, 8}, 310 {10, -1, 9}, 311 {11, -1, 10}, 312 {12, -1, 11}, 313 }; 314 } 315 316 @Test(dataProvider="plus") test_plus_long(int base, long amount, int expected)317 public void test_plus_long(int base, long amount, int expected) { 318 assertEquals(Month.of(base).plus(amount), Month.of(expected)); 319 } 320 321 //----------------------------------------------------------------------- 322 // minus(long), minus(long,unit) 323 //----------------------------------------------------------------------- 324 @DataProvider(name="minus") data_minus()325 Object[][] data_minus() { 326 return new Object[][] { 327 {1, -13, 2}, 328 {1, -12, 1}, 329 {1, -11, 12}, 330 {1, -10, 11}, 331 {1, -9, 10}, 332 {1, -8, 9}, 333 {1, -7, 8}, 334 {1, -6, 7}, 335 {1, -5, 6}, 336 {1, -4, 5}, 337 {1, -3, 4}, 338 {1, -2, 3}, 339 {1, -1, 2}, 340 {1, 0, 1}, 341 {1, 1, 12}, 342 {1, 2, 11}, 343 {1, 3, 10}, 344 {1, 4, 9}, 345 {1, 5, 8}, 346 {1, 6, 7}, 347 {1, 7, 6}, 348 {1, 8, 5}, 349 {1, 9, 4}, 350 {1, 10, 3}, 351 {1, 11, 2}, 352 {1, 12, 1}, 353 {1, 13, 12}, 354 }; 355 } 356 357 @Test(dataProvider="minus") test_minus_long(int base, long amount, int expected)358 public void test_minus_long(int base, long amount, int expected) { 359 assertEquals(Month.of(base).minus(amount), Month.of(expected)); 360 } 361 362 //----------------------------------------------------------------------- 363 // length(boolean) 364 //----------------------------------------------------------------------- 365 @Test test_length_boolean_notLeapYear()366 public void test_length_boolean_notLeapYear() { 367 assertEquals(Month.JANUARY.length(false), 31); 368 assertEquals(Month.FEBRUARY.length(false), 28); 369 assertEquals(Month.MARCH.length(false), 31); 370 assertEquals(Month.APRIL.length(false), 30); 371 assertEquals(Month.MAY.length(false), 31); 372 assertEquals(Month.JUNE.length(false), 30); 373 assertEquals(Month.JULY.length(false), 31); 374 assertEquals(Month.AUGUST.length(false), 31); 375 assertEquals(Month.SEPTEMBER.length(false), 30); 376 assertEquals(Month.OCTOBER.length(false), 31); 377 assertEquals(Month.NOVEMBER.length(false), 30); 378 assertEquals(Month.DECEMBER.length(false), 31); 379 } 380 381 @Test test_length_boolean_leapYear()382 public void test_length_boolean_leapYear() { 383 assertEquals(Month.JANUARY.length(true), 31); 384 assertEquals(Month.FEBRUARY.length(true), 29); 385 assertEquals(Month.MARCH.length(true), 31); 386 assertEquals(Month.APRIL.length(true), 30); 387 assertEquals(Month.MAY.length(true), 31); 388 assertEquals(Month.JUNE.length(true), 30); 389 assertEquals(Month.JULY.length(true), 31); 390 assertEquals(Month.AUGUST.length(true), 31); 391 assertEquals(Month.SEPTEMBER.length(true), 30); 392 assertEquals(Month.OCTOBER.length(true), 31); 393 assertEquals(Month.NOVEMBER.length(true), 30); 394 assertEquals(Month.DECEMBER.length(true), 31); 395 } 396 397 //----------------------------------------------------------------------- 398 // minLength() 399 //----------------------------------------------------------------------- 400 @Test test_minLength()401 public void test_minLength() { 402 assertEquals(Month.JANUARY.minLength(), 31); 403 assertEquals(Month.FEBRUARY.minLength(), 28); 404 assertEquals(Month.MARCH.minLength(), 31); 405 assertEquals(Month.APRIL.minLength(), 30); 406 assertEquals(Month.MAY.minLength(), 31); 407 assertEquals(Month.JUNE.minLength(), 30); 408 assertEquals(Month.JULY.minLength(), 31); 409 assertEquals(Month.AUGUST.minLength(), 31); 410 assertEquals(Month.SEPTEMBER.minLength(), 30); 411 assertEquals(Month.OCTOBER.minLength(), 31); 412 assertEquals(Month.NOVEMBER.minLength(), 30); 413 assertEquals(Month.DECEMBER.minLength(), 31); 414 } 415 416 //----------------------------------------------------------------------- 417 // maxLength() 418 //----------------------------------------------------------------------- 419 @Test test_maxLength()420 public void test_maxLength() { 421 assertEquals(Month.JANUARY.maxLength(), 31); 422 assertEquals(Month.FEBRUARY.maxLength(), 29); 423 assertEquals(Month.MARCH.maxLength(), 31); 424 assertEquals(Month.APRIL.maxLength(), 30); 425 assertEquals(Month.MAY.maxLength(), 31); 426 assertEquals(Month.JUNE.maxLength(), 30); 427 assertEquals(Month.JULY.maxLength(), 31); 428 assertEquals(Month.AUGUST.maxLength(), 31); 429 assertEquals(Month.SEPTEMBER.maxLength(), 30); 430 assertEquals(Month.OCTOBER.maxLength(), 31); 431 assertEquals(Month.NOVEMBER.maxLength(), 30); 432 assertEquals(Month.DECEMBER.maxLength(), 31); 433 } 434 435 //----------------------------------------------------------------------- 436 // firstDayOfYear(boolean) 437 //----------------------------------------------------------------------- 438 @Test test_firstDayOfYear_notLeapYear()439 public void test_firstDayOfYear_notLeapYear() { 440 assertEquals(Month.JANUARY.firstDayOfYear(false), 1); 441 assertEquals(Month.FEBRUARY.firstDayOfYear(false), 1 + 31); 442 assertEquals(Month.MARCH.firstDayOfYear(false), 1 + 31 + 28); 443 assertEquals(Month.APRIL.firstDayOfYear(false), 1 + 31 + 28 + 31); 444 assertEquals(Month.MAY.firstDayOfYear(false), 1 + 31 + 28 + 31 + 30); 445 assertEquals(Month.JUNE.firstDayOfYear(false), 1 + 31 + 28 + 31 + 30 + 31); 446 assertEquals(Month.JULY.firstDayOfYear(false), 1 + 31 + 28 + 31 + 30 + 31 + 30); 447 assertEquals(Month.AUGUST.firstDayOfYear(false), 1 + 31 + 28 + 31 + 30 + 31 + 30 + 31); 448 assertEquals(Month.SEPTEMBER.firstDayOfYear(false), 1 + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31); 449 assertEquals(Month.OCTOBER.firstDayOfYear(false), 1 + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30); 450 assertEquals(Month.NOVEMBER.firstDayOfYear(false), 1 + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31); 451 assertEquals(Month.DECEMBER.firstDayOfYear(false), 1 + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30); 452 } 453 454 @Test test_firstDayOfYear_leapYear()455 public void test_firstDayOfYear_leapYear() { 456 assertEquals(Month.JANUARY.firstDayOfYear(true), 1); 457 assertEquals(Month.FEBRUARY.firstDayOfYear(true), 1 + 31); 458 assertEquals(Month.MARCH.firstDayOfYear(true), 1 + 31 + 29); 459 assertEquals(Month.APRIL.firstDayOfYear(true), 1 + 31 + 29 + 31); 460 assertEquals(Month.MAY.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30); 461 assertEquals(Month.JUNE.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31); 462 assertEquals(Month.JULY.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31 + 30); 463 assertEquals(Month.AUGUST.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31 + 30 + 31); 464 assertEquals(Month.SEPTEMBER.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31); 465 assertEquals(Month.OCTOBER.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30); 466 assertEquals(Month.NOVEMBER.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31); 467 assertEquals(Month.DECEMBER.firstDayOfYear(true), 1 + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30); 468 } 469 470 //----------------------------------------------------------------------- 471 // firstMonthOfQuarter() 472 //----------------------------------------------------------------------- 473 @Test test_firstMonthOfQuarter()474 public void test_firstMonthOfQuarter() { 475 assertEquals(Month.JANUARY.firstMonthOfQuarter(), Month.JANUARY); 476 assertEquals(Month.FEBRUARY.firstMonthOfQuarter(), Month.JANUARY); 477 assertEquals(Month.MARCH.firstMonthOfQuarter(), Month.JANUARY); 478 assertEquals(Month.APRIL.firstMonthOfQuarter(), Month.APRIL); 479 assertEquals(Month.MAY.firstMonthOfQuarter(), Month.APRIL); 480 assertEquals(Month.JUNE.firstMonthOfQuarter(), Month.APRIL); 481 assertEquals(Month.JULY.firstMonthOfQuarter(), Month.JULY); 482 assertEquals(Month.AUGUST.firstMonthOfQuarter(), Month.JULY); 483 assertEquals(Month.SEPTEMBER.firstMonthOfQuarter(), Month.JULY); 484 assertEquals(Month.OCTOBER.firstMonthOfQuarter(), Month.OCTOBER); 485 assertEquals(Month.NOVEMBER.firstMonthOfQuarter(), Month.OCTOBER); 486 assertEquals(Month.DECEMBER.firstMonthOfQuarter(), Month.OCTOBER); 487 } 488 489 //----------------------------------------------------------------------- 490 // toString() 491 //----------------------------------------------------------------------- 492 @Test test_toString()493 public void test_toString() { 494 assertEquals(Month.JANUARY.toString(), "JANUARY"); 495 assertEquals(Month.FEBRUARY.toString(), "FEBRUARY"); 496 assertEquals(Month.MARCH.toString(), "MARCH"); 497 assertEquals(Month.APRIL.toString(), "APRIL"); 498 assertEquals(Month.MAY.toString(), "MAY"); 499 assertEquals(Month.JUNE.toString(), "JUNE"); 500 assertEquals(Month.JULY.toString(), "JULY"); 501 assertEquals(Month.AUGUST.toString(), "AUGUST"); 502 assertEquals(Month.SEPTEMBER.toString(), "SEPTEMBER"); 503 assertEquals(Month.OCTOBER.toString(), "OCTOBER"); 504 assertEquals(Month.NOVEMBER.toString(), "NOVEMBER"); 505 assertEquals(Month.DECEMBER.toString(), "DECEMBER"); 506 } 507 508 //----------------------------------------------------------------------- 509 // generated methods 510 //----------------------------------------------------------------------- 511 @Test test_enum()512 public void test_enum() { 513 assertEquals(Month.valueOf("JANUARY"), Month.JANUARY); 514 assertEquals(Month.values()[0], Month.JANUARY); 515 } 516 517 } 518