/*
 * eXist-db Open Source Native XML Database
 * Copyright (C) 2001 The eXist-db Authors
 *
 * info@exist-db.org
 * http://www.exist-db.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package org.exist.xquery.value;

import org.exist.xquery.XPathException;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class DateTimeStampTest extends AbstractTimeRelatedTestCase {


    @Test(expected = XPathException.class)
    public void crate1() throws XPathException {
        new DateTimeStampValue("2005-10-11T10:00:00");
    }

    @Test
    public void convert1() throws XPathException {
        DateTimeValue dateTimeValue = new DateTimeValue("2005-10-11T10:00:00Z");
        AtomicValue value = dateTimeValue.convertTo(Type.DATE_TIME_STAMP);
        assertEquals(DateTimeStampValue.class, value.getClass());
    }

    @Test(expected = XPathException.class)
    public void convert2() throws XPathException {
        DateTimeValue dateTimeValue = new DateTimeValue("2005-10-11T10:00:00");
        AtomicValue value = dateTimeValue.convertTo(Type.DATE_TIME_STAMP);
        assertEquals(DateTimeStampValue.class, value.getClass());
    }

    @Test()
    public void getTimezone1() throws XPathException {
        DateTimeStampValue value = new DateTimeStampValue("2005-10-11T10:00:00+10:00");
        assertEquals(10 * 60, value.calendar.getTimezone());
    }






}

@@ -1160,13 +1160,31 @@
 id c
-rate1
+onstructWithoutTimeZone
 () t
@@ -1301,17 +1301,51 @@
  convert
-1
+DateTimeWithTimeZoneToDateTimeStamp
 () throw
@@ -1363,32 +1363,38 @@
 ption %7B%0A        
+final 
 DateTimeValue da
@@ -1450,32 +1450,38 @@
 :00Z%22);%0A        
+final 
 AtomicValue valu
@@ -1670,17 +1670,54 @@
  convert
-2
+DateTimeWithoutTimeZoneToDateTimeStamp
 () throw
@@ -1735,32 +1735,38 @@
 ption %7B%0A        
+final 
 DateTimeValue da
@@ -1829,16 +1829,22 @@
         
+final 
 AtomicVa
@@ -2014,17 +2014,16 @@
 Timezone
-1
 () throw
@@ -2049,16 +2049,22 @@
         
+final 
 DateTime
@@ -2202,16 +2202,10 @@
 ;%0A    %7D%0A
-%0A%0A%0A%0A%0A%0A
 %7D%0A

Address code review