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.*; 025 026 027/** 028 * Used for assertion calls against {@link ZonedDateTime} objects. 029 * 030 * <h5 class='section'>Example:</h5> 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 * <h5 class='section'>Test Methods:</h5> 038 * <p> 039 * <ul class='javatree'> 040 * <li class='jc'>{@link FluentZonedDateTimeAssertion} 041 * <ul class='javatreec'> 042 * <li class='jm'>{@link FluentZonedDateTimeAssertion#is(ZonedDateTime,ChronoUnit) is(ZonedDateTime,ChronoUnit)} 043 * <li class='jm'>{@link FluentZonedDateTimeAssertion#isAfter(ZonedDateTime) isAfter(ZonedDateTime)} 044 * <li class='jm'>{@link FluentZonedDateTimeAssertion#isAfterNow() isAfterNow()} 045 * <li class='jm'>{@link FluentZonedDateTimeAssertion#isBefore(ZonedDateTime) isBefore(ZonedDateTime)} 046 * <li class='jm'>{@link FluentZonedDateTimeAssertion#isBeforeNow() isBeforeNow()} 047 * <li class='jm'>{@link FluentZonedDateTimeAssertion#isBetween(ZonedDateTime,ZonedDateTime) isBetween(ZonedDateTime,ZonedDateTime)} 048 * </ul> 049 * <li class='jc'>{@link FluentComparableAssertion} 050 * <ul class='javatreec'> 051 * <li class='jm'>{@link FluentComparableAssertion#isGt(Comparable) isGt(Comparable)} 052 * <li class='jm'>{@link FluentComparableAssertion#isGte(Comparable) isGte(Comparable)} 053 * <li class='jm'>{@link FluentComparableAssertion#isLt(Comparable) isLt(Comparable)} 054 * <li class='jm'>{@link FluentComparableAssertion#isLte(Comparable) isLte(Comparable)} 055 * <li class='jm'>{@link FluentComparableAssertion#isBetween(Comparable,Comparable) isBetween(Comparable,Comparable)} 056 * </ul> 057 * <li class='jc'>{@link FluentObjectAssertion} 058 * <ul class='javatreec'> 059 * <li class='jm'>{@link FluentObjectAssertion#isExists() isExists()} 060 * <li class='jm'>{@link FluentObjectAssertion#is(Object) is(Object)} 061 * <li class='jm'>{@link FluentObjectAssertion#is(Predicate) is(Predicate)} 062 * <li class='jm'>{@link FluentObjectAssertion#isNot(Object) isNot(Object)} 063 * <li class='jm'>{@link FluentObjectAssertion#isAny(Object...) isAny(Object...)} 064 * <li class='jm'>{@link FluentObjectAssertion#isNotAny(Object...) isNotAny(Object...)} 065 * <li class='jm'>{@link FluentObjectAssertion#isNull() isNull()} 066 * <li class='jm'>{@link FluentObjectAssertion#isNotNull() isNotNull()} 067 * <li class='jm'>{@link FluentObjectAssertion#isString(String) isString(String)} 068 * <li class='jm'>{@link FluentObjectAssertion#isSame(Object) isSame(Object)} 069 * <li class='jm'>{@link FluentObjectAssertion#isType(Class) isType(Class)} 070 * <li class='jm'>{@link FluentObjectAssertion#isExactType(Class) isExactType(Class)} 071 * </ul> 072 * </ul> 073 * 074 * <h5 class='section'>Transform Methods:</h5> 075 * <p> 076 * <ul class='javatree'> 077 * <li class='jc'>{@link FluentObjectAssertion} 078 * <ul class='javatreec'> 079 * <li class='jm'>{@link FluentObjectAssertion#asString() asString()} 080 * <li class='jm'>{@link FluentObjectAssertion#asString(ThrowingFunction) asString(ThrowingFunction)} 081 * <li class='jm'>{@link FluentObjectAssertion#asTransformed(UnaryOperator) asTransformed(UnaryOperator)} 082 * <li class='jm'>{@link FluentObjectAssertion#asAny() asAny()} 083 * </ul> 084 * </ul> 085 * 086 * <h5 class='section'>Configuration Methods:</h5> 087 * <p> 088 * <ul class='javatree'> 089 * <li class='jc'>{@link Assertion} 090 * <ul class='javatreec'> 091 * <li class='jm'>{@link Assertion#setMsg(String, Object...) setMsg(String, Object...)} 092 * <li class='jm'>{@link Assertion#setOut(PrintStream) setOut(PrintStream)} 093 * <li class='jm'>{@link Assertion#setSilent() setSilent()} 094 * <li class='jm'>{@link Assertion#setStdOut() setStdOut()} 095 * <li class='jm'>{@link Assertion#setThrowable(Class) setThrowable(Class)} 096 * </ul> 097 * </ul> 098 * 099 * <h5 class='section'>See Also:</h5><ul> 100 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauEcosystemOverview">Juneau Ecosystem</a> 101 * </ul> 102 */ 103@SuppressWarnings({ 104 "java:S110" // Inheritance depth acceptable for ZonedDateTimeAssertion hierarchy 105}) 106public class ZonedDateTimeAssertion extends FluentZonedDateTimeAssertion<ZonedDateTimeAssertion> { 107 108 /** 109 * Static creator. 110 * 111 * @param value 112 * The object being tested. 113 * <br>Can be <jk>null</jk> (assertions such as {@code isNull()} then operate on the absence of a value). 114 * @return A new assertion object. 115 */ 116 public static ZonedDateTimeAssertion create(ZonedDateTime value) { 117 return new ZonedDateTimeAssertion(value); 118 } 119 120 /** 121 * Constructor. 122 * 123 * @param value 124 * The object being tested. 125 * <br>Can be <jk>null</jk> (assertions such as {@code isNull()} then operate on the absence of a value). 126 */ 127 public ZonedDateTimeAssertion(ZonedDateTime value) { 128 super(value, null); 129 } 130 131 @Override /* Overridden from Assertion */ 132 public ZonedDateTimeAssertion setMsg(String msg, Object...args) { 133 super.setMsg(msg, args); 134 return this; 135 } 136 137 @Override /* Overridden from Assertion */ 138 public ZonedDateTimeAssertion setOut(PrintStream value) { 139 super.setOut(value); 140 return this; 141 } 142 143 @Override /* Overridden from Assertion */ 144 public ZonedDateTimeAssertion setSilent() { 145 super.setSilent(); 146 return this; 147 } 148 149 @Override /* Overridden from Assertion */ 150 public ZonedDateTimeAssertion setStdOut() { 151 super.setStdOut(); 152 return this; 153 } 154 155 @Override /* Overridden from Assertion */ 156 public ZonedDateTimeAssertion setThrowable(Class<? extends RuntimeException> value) { 157 super.setThrowable(value); 158 return this; 159 } 160}