test/java/time/tck/java/time/zone/TCKFixedZoneRules.java

Print this page




  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.zone;
  61 
  62 import java.time.zone.*;
  63 import test.java.time.zone.*;
  64 
  65 import static org.testng.Assert.assertEquals;
  66 
  67 import java.io.ByteArrayInputStream;
  68 import java.io.ByteArrayOutputStream;
  69 import java.io.ObjectInputStream;
  70 import java.io.ObjectOutputStream;
  71 
  72 import java.time.Duration;
  73 import java.time.Instant;
  74 import java.time.LocalDateTime;
  75 import java.time.LocalTime;
  76 import java.time.Month;
  77 import java.time.ZoneOffset;


  78 import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition;

  79 
  80 import org.testng.annotations.DataProvider;
  81 import org.testng.annotations.Test;
  82 
  83 /**
  84  * Test ZoneRules for fixed offset time-zones.
  85  */
  86 @Test
  87 public class TCKFixedZoneRules {
  88 
  89     private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
  90     private static final ZoneOffset OFFSET_PTWO = ZoneOffset.ofHours(2);
  91     private static final ZoneOffset OFFSET_M18 = ZoneOffset.ofHours(-18);
  92     private static final LocalDateTime LDT = LocalDateTime.of(2010, 12, 3, 11, 30);
  93     private static final Instant INSTANT = LDT.toInstant(OFFSET_PONE);
  94 
  95     private ZoneRules make(ZoneOffset offset) {
  96         return offset.getRules();
  97     }
  98 




  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.zone;
  61 



  62 import static org.testng.Assert.assertEquals;
  63 
  64 import java.io.ByteArrayInputStream;
  65 import java.io.ByteArrayOutputStream;
  66 import java.io.ObjectInputStream;
  67 import java.io.ObjectOutputStream;
  68 
  69 import java.time.Duration;
  70 import java.time.Instant;
  71 import java.time.LocalDateTime;
  72 import java.time.LocalTime;
  73 import java.time.Month;
  74 import java.time.ZoneOffset;
  75 import java.time.zone.ZoneOffsetTransition;
  76 import java.time.zone.ZoneOffsetTransitionRule;
  77 import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition;
  78 import java.time.zone.ZoneRules;
  79 
  80 import org.testng.annotations.DataProvider;
  81 import org.testng.annotations.Test;
  82 
  83 /**
  84  * Test ZoneRules for fixed offset time-zones.
  85  */
  86 @Test
  87 public class TCKFixedZoneRules {
  88 
  89     private static final ZoneOffset OFFSET_PONE = ZoneOffset.ofHours(1);
  90     private static final ZoneOffset OFFSET_PTWO = ZoneOffset.ofHours(2);
  91     private static final ZoneOffset OFFSET_M18 = ZoneOffset.ofHours(-18);
  92     private static final LocalDateTime LDT = LocalDateTime.of(2010, 12, 3, 11, 30);
  93     private static final Instant INSTANT = LDT.toInstant(OFFSET_PONE);
  94 
  95     private ZoneRules make(ZoneOffset offset) {
  96         return offset.getRules();
  97     }
  98