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