001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.assertions;
014
015import java.io.*;
016import java.util.function.*;
017
018import org.apache.juneau.*;
019import org.apache.juneau.internal.*;
020import org.apache.juneau.serializer.*;
021
022/**
023 * Used for assertion calls against {@link Version} objects.
024 *
025 * <h5 class='section'>Example:</h5>
026 * <p class='bjava'>
027 *    <jc>// Validates the specified date is after the current date.</jc>
028 *    <jsm>assertVersion</jsm>(<jv>myVersion</jv>).asMajor().isGreaterThan(2);
029 * </p>
030 *
031 *
032* <h5 class='section'>Test Methods:</h5>
033 * <p>
034 * <ul class='javatree'>
035 *    <li class='jc'>{@link FluentComparableAssertion}
036 *    <ul class='javatreec'>
037 *       <li class='jm'>{@link FluentComparableAssertion#isGt(Comparable) isGt(Comparable)}
038 *       <li class='jm'>{@link FluentComparableAssertion#isGte(Comparable) isGte(Comparable)}
039 *       <li class='jm'>{@link FluentComparableAssertion#isLt(Comparable) isLt(Comparable)}
040 *       <li class='jm'>{@link FluentComparableAssertion#isLte(Comparable) isLte(Comparable)}
041 *       <li class='jm'>{@link FluentComparableAssertion#isBetween(Comparable,Comparable) isBetween(Comparable,Comparable)}
042  *   </ul>
043 *    <li class='jc'>{@link FluentObjectAssertion}
044 *    <ul class='javatreec'>
045 *       <li class='jm'>{@link FluentObjectAssertion#isExists() isExists()}
046 *       <li class='jm'>{@link FluentObjectAssertion#is(Object) is(Object)}
047 *       <li class='jm'>{@link FluentObjectAssertion#is(Predicate) is(Predicate)}
048 *       <li class='jm'>{@link FluentObjectAssertion#isNot(Object) isNot(Object)}
049 *       <li class='jm'>{@link FluentObjectAssertion#isAny(Object...) isAny(Object...)}
050 *       <li class='jm'>{@link FluentObjectAssertion#isNotAny(Object...) isNotAny(Object...)}
051 *       <li class='jm'>{@link FluentObjectAssertion#isNull() isNull()}
052 *       <li class='jm'>{@link FluentObjectAssertion#isNotNull() isNotNull()}
053 *       <li class='jm'>{@link FluentObjectAssertion#isString(String) isString(String)}
054 *       <li class='jm'>{@link FluentObjectAssertion#isJson(String) isJson(String)}
055 *       <li class='jm'>{@link FluentObjectAssertion#isSame(Object) isSame(Object)}
056 *       <li class='jm'>{@link FluentObjectAssertion#isSameJsonAs(Object) isSameJsonAs(Object)}
057 *       <li class='jm'>{@link FluentObjectAssertion#isSameSortedJsonAs(Object) isSameSortedJsonAs(Object)}
058 *       <li class='jm'>{@link FluentObjectAssertion#isSameSerializedAs(Object, WriterSerializer) isSameSerializedAs(Object, WriterSerializer)}
059 *       <li class='jm'>{@link FluentObjectAssertion#isType(Class) isType(Class)}
060 *       <li class='jm'>{@link FluentObjectAssertion#isExactType(Class) isExactType(Class)}
061 *    </ul>
062 * </ul>
063 *
064 * <h5 class='section'>Transform Methods:</h5>
065 * <p>
066 * <ul class='javatree'>
067 *    <li class='jc'>{@link FluentVersionAssertion}
068 *    <ul class='javatreec'>
069 *       <li class='jm'>{@link FluentVersionAssertion#asPart(int) asPart(int)}
070 *       <li class='jm'>{@link FluentVersionAssertion#asMajor() asMajor()}
071 *       <li class='jm'>{@link FluentVersionAssertion#asMinor() asMinor()}
072 *       <li class='jm'>{@link FluentVersionAssertion#asMaintenance() asMaintenance()}
073 *    </ul>
074 *    <li class='jc'>{@link FluentObjectAssertion}
075 *    <ul class='javatreec'>
076 *       <li class='jm'>{@link FluentObjectAssertion#asString() asString()}
077 *       <li class='jm'>{@link FluentObjectAssertion#asString(WriterSerializer) asString(WriterSerializer)}
078 *       <li class='jm'>{@link FluentObjectAssertion#asString(Function) asString(Function)}
079 *       <li class='jm'>{@link FluentObjectAssertion#asJson() asJson()}
080 *       <li class='jm'>{@link FluentObjectAssertion#asJsonSorted() asJsonSorted()}
081 *       <li class='jm'>{@link FluentObjectAssertion#asTransformed(Function) asApplied(Function)}
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="../../../../index.html#ja.Overview">Overview &gt; juneau-assertions &gt; Overview</a>
101 * </ul>
102 */
103@FluentSetters(returns="VersionAssertion")
104public class VersionAssertion extends FluentVersionAssertion<VersionAssertion> {
105
106   //-----------------------------------------------------------------------------------------------------------------
107   // Static
108   //-----------------------------------------------------------------------------------------------------------------
109
110   /**
111    * Static creator.
112    *
113    * @param value
114    *    The object being tested.
115    *    <br>Can be <jk>null</jk>.
116    * @return A new assertion object.
117    */
118   public static VersionAssertion create(Version value) {
119      return new VersionAssertion(value);
120   }
121
122   //-----------------------------------------------------------------------------------------------------------------
123   // Instance
124   //-----------------------------------------------------------------------------------------------------------------
125
126   /**
127    * Constructor.
128    *
129    * @param value
130    *    The object being tested.
131    *    <br>Can be <jk>null</jk>.
132    */
133   public VersionAssertion(Version value) {
134      super(value, null);
135   }
136
137   //-----------------------------------------------------------------------------------------------------------------
138   // Fluent setters
139   //-----------------------------------------------------------------------------------------------------------------
140
141   // <FluentSetters>
142
143   @Override /* GENERATED - org.apache.juneau.assertions.Assertion */
144   public VersionAssertion setMsg(String msg, Object...args) {
145      super.setMsg(msg, args);
146      return this;
147   }
148
149   @Override /* GENERATED - org.apache.juneau.assertions.Assertion */
150   public VersionAssertion setOut(PrintStream value) {
151      super.setOut(value);
152      return this;
153   }
154
155   @Override /* GENERATED - org.apache.juneau.assertions.Assertion */
156   public VersionAssertion setSilent() {
157      super.setSilent();
158      return this;
159   }
160
161   @Override /* GENERATED - org.apache.juneau.assertions.Assertion */
162   public VersionAssertion setStdOut() {
163      super.setStdOut();
164      return this;
165   }
166
167   @Override /* GENERATED - org.apache.juneau.assertions.Assertion */
168   public VersionAssertion setThrowable(Class<? extends java.lang.RuntimeException> value) {
169      super.setThrowable(value);
170      return this;
171   }
172
173   // </FluentSetters>
174}