test/java/time/test/java/time/TestOffsetDateTime_instants.java
Print this page
*** 55,82 ****
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
! package test.java.time.temporal;
import java.time.DateTimeException;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.Month;
import java.time.ZoneOffset;
! import java.time.temporal.OffsetDateTime;
! import java.time.temporal.Year;
import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;
/**
! * Test OffsetDate creation.
*/
@Test
public class TestOffsetDateTime_instants {
private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
--- 55,82 ----
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
! package test.java.time;
import java.time.DateTimeException;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.Month;
import java.time.ZoneOffset;
! import java.time.OffsetDateTime;
! import java.time.Year;
import static org.testng.Assert.assertEquals;
import org.testng.annotations.Test;
/**
! * Test OffsetDateTime creation.
*/
@Test
public class TestOffsetDateTime_instants {
private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
*** 241,251 ****
for (long i = minDays; i < maxDays; i++) {
Instant instant = Instant.ofEpochSecond(i * 24L * 60L * 60L);
try {
OffsetDateTime test = OffsetDateTime.ofInstant(instant, ZoneOffset.UTC);
assertEquals(test, expected);
! if (expected.getDate().equals(maxDate) == false) {
expected = expected.plusDays(1);
}
} catch (RuntimeException|Error ex) {
System.out.println("Error: " + i + " " + expected);
throw ex;
--- 241,251 ----
for (long i = minDays; i < maxDays; i++) {
Instant instant = Instant.ofEpochSecond(i * 24L * 60L * 60L);
try {
OffsetDateTime test = OffsetDateTime.ofInstant(instant, ZoneOffset.UTC);
assertEquals(test, expected);
! if (expected.toLocalDate().equals(maxDate) == false) {
expected = expected.plusDays(1);
}
} catch (RuntimeException|Error ex) {
System.out.println("Error: " + i + " " + expected);
throw ex;