< prev index next >

test/java/time/tck/java/time/TCKLocalDate.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2012, 2015, 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. --- 1,7 ---- /* ! * 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.
*** 1283,1297 **** @Test(expectedExceptions={ArithmeticException.class}) public void test_plusWeeks_invalidMaxMinusMin() { LocalDate.of(Year.MAX_VALUE, 12, 25).plusWeeks(Long.MIN_VALUE); } ! @Test ! public void test_plusDays_normal() { ! LocalDate t = TEST_2007_07_15.plusDays(1); ! assertEquals(t, LocalDate.of(2007, 7, 16)); } @Test public void test_plusDays_overMonths() { LocalDate t = TEST_2007_07_15.plusDays(62); --- 1283,1309 ---- @Test(expectedExceptions={ArithmeticException.class}) public void test_plusWeeks_invalidMaxMinusMin() { LocalDate.of(Year.MAX_VALUE, 12, 25).plusWeeks(Long.MIN_VALUE); } + //----------------------------------------------------------------------- + @DataProvider(name="PlusDays") + Object[][] provider_plusDays() { + return new Object[][] { + {LocalDate.of(2007, 7, 15), 1, LocalDate.of(2007, 7, 16)}, + {LocalDate.of(2007, 7, 15), 17, LocalDate.of(2007, 8, 1)}, + {LocalDate.of(2007, 12, 31), 1, LocalDate.of(2008, 1, 1)}, + {LocalDate.of(2007, 1, 1), 58, LocalDate.of(2007, 2, 28)}, + {LocalDate.of(2007, 1, 1), 59, LocalDate.of(2007, 3, 1)}, + {LocalDate.of(2008, 1, 1), 60, LocalDate.of(2008, 3, 1)}, + }; + } ! @Test(dataProvider="PlusDays") ! public void test_plusDays_normal(LocalDate input, int amountsToAdd, LocalDate expected) { ! LocalDate actual = input.plusDays(amountsToAdd); ! assertEquals(actual, expected); } @Test public void test_plusDays_overMonths() { LocalDate t = TEST_2007_07_15.plusDays(62);
< prev index next >