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
015
016import java.io.*;
017import java.util.function.*;
018
019import org.apache.juneau.internal.*;
020import org.apache.juneau.serializer.*;
021
022/**
023 * Used for fluent assertion calls against integers.
024 *
025 * <h5 class='section'>Example:</h5>
026 * <p class='bjava'>
027 *    <jc>// Validates the response status code is 200 or 404.</jc>
028 *    <jv>client</jv>
029 *       .get(<jsf>URL</jsf>)
030 *       .run()
031 *       .assertStatus().isAny(200,404);
032 * </p>
033 *
034 *
035 * <h5 class='section'>Test Methods:</h5>
036 * <p>
037 * <ul class='javatree'>
038 *    <li class='jc'>{@link FluentComparableAssertion}
039 *    <ul class='javatreec'>
040 *       <li class='jm'>{@link FluentComparableAssertion#isGt(Comparable) isGt(Comparable)}
041 *       <li class='jm'>{@link FluentComparableAssertion#isGte(Comparable) isGte(Comparable)}
042 *       <li class='jm'>{@link FluentComparableAssertion#isLt(Comparable) isLt(Comparable)}
043 *       <li class='jm'>{@link FluentComparableAssertion#isLte(Comparable) isLte(Comparable)}
044 *       <li class='jm'>{@link FluentComparableAssertion#isBetween(Comparable,Comparable) isBetween(Comparable,Comparable)}
045  *   </ul>
046 *    <li class='jc'>{@link FluentObjectAssertion}
047 *    <ul class='javatreec'>
048 *       <li class='jm'>{@link FluentObjectAssertion#isExists() isExists()}
049 *       <li class='jm'>{@link FluentObjectAssertion#is(Object) is(Object)}
050 *       <li class='jm'>{@link FluentObjectAssertion#is(Predicate) is(Predicate)}
051 *       <li class='jm'>{@link FluentObjectAssertion#isNot(Object) isNot(Object)}
052 *       <li class='jm'>{@link FluentObjectAssertion#isAny(Object...) isAny(Object...)}
053 *       <li class='jm'>{@link FluentObjectAssertion#isNotAny(Object...) isNotAny(Object...)}
054 *       <li class='jm'>{@link FluentObjectAssertion#isNull() isNull()}
055 *       <li class='jm'>{@link FluentObjectAssertion#isNotNull() isNotNull()}
056 *       <li class='jm'>{@link FluentObjectAssertion#isString(String) isString(String)}
057 *       <li class='jm'>{@link FluentObjectAssertion#isJson(String) isJson(String)}
058 *       <li class='jm'>{@link FluentObjectAssertion#isSame(Object) isSame(Object)}
059 *       <li class='jm'>{@link FluentObjectAssertion#isSameJsonAs(Object) isSameJsonAs(Object)}
060 *       <li class='jm'>{@link FluentObjectAssertion#isSameSortedJsonAs(Object) isSameSortedJsonAs(Object)}
061 *       <li class='jm'>{@link FluentObjectAssertion#isSameSerializedAs(Object, WriterSerializer) isSameSerializedAs(Object, WriterSerializer)}
062 *       <li class='jm'>{@link FluentObjectAssertion#isType(Class) isType(Class)}
063 *       <li class='jm'>{@link FluentObjectAssertion#isExactType(Class) isExactType(Class)}
064 *    </ul>
065 * </ul>
066 *
067 * <h5 class='section'>Transform Methods:</h5>
068 * <p>
069 * <ul class='javatree'>
070 *    <li class='jc'>{@link FluentObjectAssertion}
071 *    <ul class='javatreec'>
072 *       <li class='jm'>{@link FluentObjectAssertion#asString() asString()}
073 *       <li class='jm'>{@link FluentObjectAssertion#asString(WriterSerializer) asString(WriterSerializer)}
074 *       <li class='jm'>{@link FluentObjectAssertion#asString(Function) asString(Function)}
075 *       <li class='jm'>{@link FluentObjectAssertion#asJson() asJson()}
076 *       <li class='jm'>{@link FluentObjectAssertion#asJsonSorted() asJsonSorted()}
077 *       <li class='jm'>{@link FluentObjectAssertion#asTransformed(Function) asApplied(Function)}
078 *       <li class='jm'>{@link FluentObjectAssertion#asAny() asAny()}
079 * </ul>
080 * </ul>
081 *
082 * <h5 class='section'>Configuration Methods:</h5>
083 * <p>
084 * <ul class='javatree'>
085 *    <li class='jc'>{@link Assertion}
086 *    <ul class='javatreec'>
087 *       <li class='jm'>{@link Assertion#setMsg(String, Object...) setMsg(String, Object...)}
088 *       <li class='jm'>{@link Assertion#setOut(PrintStream) setOut(PrintStream)}
089 *       <li class='jm'>{@link Assertion#setSilent() setSilent()}
090 *       <li class='jm'>{@link Assertion#setStdOut() setStdOut()}
091 *       <li class='jm'>{@link Assertion#setThrowable(Class) setThrowable(Class)}
092 *    </ul>
093 * </ul>
094 *
095 * <h5 class='section'>See Also:</h5><ul>
096 *    <li class='link'><a class="doclink" href="../../../../index.html#ja.Overview">Overview &gt; juneau-assertions &gt; Overview</a>
097 * </ul>
098 *
099 * @param <R> The return type.
100 */
101@FluentSetters(returns="FluentIntegerAssertion<R>")
102public class FluentIntegerAssertion<R> extends FluentComparableAssertion<Integer,R> {
103
104   //-----------------------------------------------------------------------------------------------------------------
105   // Instance
106   //-----------------------------------------------------------------------------------------------------------------
107
108   /**
109    * Constructor.
110    *
111    * @param value
112    *    The object being tested.
113    *    <br>Can be <jk>null</jk>.
114    * @param returns
115    *    The object to return after a test method is called.
116    *    <br>If <jk>null</jk>, the test method returns this object allowing multiple test method calls to be
117    * used on the same assertion.
118    */
119   public FluentIntegerAssertion(Integer value, R returns) {
120      this(null, value, returns);
121   }
122
123   /**
124    * Chained constructor.
125    *
126    * <p>
127    * Used when transforming one assertion into another so that the assertion config can be used by the new assertion.
128    *
129    * @param creator
130    *    The assertion that created this assertion.
131    *    <br>Should be <jk>null</jk> if this is the top-level assertion.
132    * @param value
133    *    The object being tested.
134    *    <br>Can be <jk>null</jk>.
135    * @param returns
136    *    The object to return after a test method is called.
137    *    <br>If <jk>null</jk>, the test method returns this object allowing multiple test method calls to be
138    * used on the same assertion.
139    */
140   public FluentIntegerAssertion(Assertion creator, Integer value, R returns) {
141      super(creator, value, returns);
142   }
143
144   //-----------------------------------------------------------------------------------------------------------------
145   // Fluent setters
146   //-----------------------------------------------------------------------------------------------------------------
147
148   // <FluentSetters>
149
150   @Override /* GENERATED - org.apache.juneau.assertions.Assertion */
151   public FluentIntegerAssertion<R> setMsg(String msg, Object...args) {
152      super.setMsg(msg, args);
153      return this;
154   }
155
156   @Override /* GENERATED - org.apache.juneau.assertions.Assertion */
157   public FluentIntegerAssertion<R> setOut(PrintStream value) {
158      super.setOut(value);
159      return this;
160   }
161
162   @Override /* GENERATED - org.apache.juneau.assertions.Assertion */
163   public FluentIntegerAssertion<R> setSilent() {
164      super.setSilent();
165      return this;
166   }
167
168   @Override /* GENERATED - org.apache.juneau.assertions.Assertion */
169   public FluentIntegerAssertion<R> setStdOut() {
170      super.setStdOut();
171      return this;
172   }
173
174   @Override /* GENERATED - org.apache.juneau.assertions.Assertion */
175   public FluentIntegerAssertion<R> setThrowable(Class<? extends java.lang.RuntimeException> value) {
176      super.setThrowable(value);
177      return this;
178   }
179
180   // </FluentSetters>
181}