001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.bct.assertions;
018
019import java.io.*;
020import java.time.*;
021import java.time.temporal.*;
022import java.util.function.*;
023
024import org.apache.juneau.commons.function.*; // NOSONAR java:S1128 - used only by Javadoc {@link} references
025
026
027/**
028 * Used for assertion calls against {@link ZonedDateTime} objects.
029 *
030 * <h2 class='section'>Example:</h2>
031 * <p class='bjava'>
032 *    <jc>// Validates the specified date is after the current date.</jc>
033 *    <jsm>assertZonedDateTime</jsm>(<jv>myZdt</jv>).isAfterNow();
034 * </p>
035 *
036 *
037 * <h2 class='section'>Test Methods:</h2>
038 * <ul class='javatree'>
039 *    <li class='jc'>{@link FluentZonedDateTimeAssertion}
040 *    <ul class='javatreec'>
041 *       <li class='jm'>{@link FluentZonedDateTimeAssertion#is(ZonedDateTime,ChronoUnit) is(ZonedDateTime,ChronoUnit)}
042 *       <li class='jm'>{@link FluentZonedDateTimeAssertion#isAfter(ZonedDateTime) isAfter(ZonedDateTime)}
043 *       <li class='jm'>{@link FluentZonedDateTimeAssertion#isAfterNow() isAfterNow()}
044 *       <li class='jm'>{@link FluentZonedDateTimeAssertion#isBefore(ZonedDateTime) isBefore(ZonedDateTime)}
045 *       <li class='jm'>{@link FluentZonedDateTimeAssertion#isBeforeNow() isBeforeNow()}
046 *       <li class='jm'>{@link FluentZonedDateTimeAssertion#isBetween(ZonedDateTime,ZonedDateTime) isBetween(ZonedDateTime,ZonedDateTime)}
047 *    </ul>
048 *    <li class='jc'>{@link FluentComparableAssertion}
049 *    <ul class='javatreec'>
050 *       <li class='jm'>{@link FluentComparableAssertion#isGt(Comparable) isGt(Comparable)}
051 *       <li class='jm'>{@link FluentComparableAssertion#isGte(Comparable) isGte(Comparable)}
052 *       <li class='jm'>{@link FluentComparableAssertion#isLt(Comparable) isLt(Comparable)}
053 *       <li class='jm'>{@link FluentComparableAssertion#isLte(Comparable) isLte(Comparable)}
054 *       <li class='jm'>{@link FluentComparableAssertion#isBetween(Comparable,Comparable) isBetween(Comparable,Comparable)}
055 *    </ul>
056 *    <li class='jc'>{@link FluentObjectAssertion}
057 *    <ul class='javatreec'>
058 *       <li class='jm'>{@link FluentObjectAssertion#isExists() isExists()}
059 *       <li class='jm'>{@link FluentObjectAssertion#is(Object) is(Object)}
060 *       <li class='jm'>{@link FluentObjectAssertion#is(Predicate) is(Predicate)}
061 *       <li class='jm'>{@link FluentObjectAssertion#isNot(Object) isNot(Object)}
062 *       <li class='jm'>{@link FluentObjectAssertion#isAny(Object...) isAny(Object...)}
063 *       <li class='jm'>{@link FluentObjectAssertion#isNotAny(Object...) isNotAny(Object...)}
064 *       <li class='jm'>{@link FluentObjectAssertion#isNull() isNull()}
065 *       <li class='jm'>{@link FluentObjectAssertion#isNotNull() isNotNull()}
066 *       <li class='jm'>{@link FluentObjectAssertion#isString(String) isString(String)}
067 *       <li class='jm'>{@link FluentObjectAssertion#isSame(Object) isSame(Object)}
068 *       <li class='jm'>{@link FluentObjectAssertion#isType(Class) isType(Class)}
069 *       <li class='jm'>{@link FluentObjectAssertion#isExactType(Class) isExactType(Class)}
070 *    </ul>
071 * </ul>
072 *
073 * <h2 class='section'>Transform Methods:</h2>
074 * <ul class='javatree'>
075 *    <li class='jc'>{@link FluentObjectAssertion}
076 *    <ul class='javatreec'>
077 *       <li class='jm'>{@link FluentObjectAssertion#asString() asString()}
078 *       <li class='jm'>{@link FluentObjectAssertion#asString(ThrowingFunction) asString(ThrowingFunction)}
079 *       <li class='jm'>{@link FluentObjectAssertion#asTransformed(UnaryOperator) asTransformed(UnaryOperator)}
080 *       <li class='jm'>{@link FluentObjectAssertion#asAny() asAny()}
081 * </ul>
082 * </ul>
083 *
084 * <h2 class='section'>Configuration Methods:</h2>
085 * <ul class='javatree'>
086 *    <li class='jc'>{@link Assertion}
087 *    <ul class='javatreec'>
088 *       <li class='jm'>{@link Assertion#setMsg(String, Object...) setMsg(String, Object...)}
089 *       <li class='jm'>{@link Assertion#setOut(PrintStream) setOut(PrintStream)}
090 *       <li class='jm'>{@link Assertion#setSilent() setSilent()}
091 *       <li class='jm'>{@link Assertion#setStdOut() setStdOut()}
092 *       <li class='jm'>{@link Assertion#setThrowable(Class) setThrowable(Class)}
093 *    </ul>
094 * </ul>
095 *
096 * <h2 class='section'>See Also:</h2><ul>
097 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauEcosystemOverview">Juneau Ecosystem</a>
098 * </ul>
099 */
100@SuppressWarnings({
101   "java:S110" // Inheritance depth acceptable for ZonedDateTimeAssertion hierarchy
102})
103public class ZonedDateTimeAssertion extends FluentZonedDateTimeAssertion<ZonedDateTimeAssertion> {
104
105   /**
106    * Static creator.
107    *
108    * @param value
109    *    The object being tested.
110    *    <br>Can be <jk>null</jk> (assertions such as {@code isNull()} then operate on the absence of a value).
111    * @return A new assertion object.
112    */
113   public static ZonedDateTimeAssertion create(ZonedDateTime value) {
114      return new ZonedDateTimeAssertion(value);
115   }
116
117   /**
118    * Constructor.
119    *
120    * @param value
121    *    The object being tested.
122    *    <br>Can be <jk>null</jk> (assertions such as {@code isNull()} then operate on the absence of a value).
123    */
124   public ZonedDateTimeAssertion(ZonedDateTime value) {
125      super(value, null);
126   }
127
128   @Override /* Overridden from Assertion */
129   public ZonedDateTimeAssertion setMsg(String msg, Object...args) {
130      super.setMsg(msg, args);
131      return this;
132   }
133
134   @Override /* Overridden from Assertion */
135   public ZonedDateTimeAssertion setOut(PrintStream value) {
136      super.setOut(value);
137      return this;
138   }
139
140   @Override /* Overridden from Assertion */
141   public ZonedDateTimeAssertion setSilent() {
142      super.setSilent();
143      return this;
144   }
145
146   @Override /* Overridden from Assertion */
147   public ZonedDateTimeAssertion setStdOut() {
148      super.setStdOut();
149      return this;
150   }
151
152   @Override /* Overridden from Assertion */
153   public ZonedDateTimeAssertion setThrowable(Class<? extends RuntimeException> value) {
154      super.setThrowable(value);
155      return this;
156   }
157}