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 longs. 023 * 024 * <h5 class='section'>Example:</h5> 025 * <p class='bjava'> 026 * <jc>// Validates the response length isn't too long.</jc> 027 * <jsm>assertLong</jsm>(<jv>responseLength</jv>).isLessThan(100000); 028 * </p> 029 * 030 * 031 * <h5 class='section'>Test Methods:</h5> 032 * <p> 033 * <ul class='javatree'> 034 * <li class='jc'>{@link FluentComparableAssertion} 035 * <ul class='javatreec'> 036 * <li class='jm'>{@link FluentComparableAssertion#isGt(Comparable) isGt(Comparable)} 037 * <li class='jm'>{@link FluentComparableAssertion#isGte(Comparable) isGte(Comparable)} 038 * <li class='jm'>{@link FluentComparableAssertion#isLt(Comparable) isLt(Comparable)} 039 * <li class='jm'>{@link FluentComparableAssertion#isLte(Comparable) isLte(Comparable)} 040 * <li class='jm'>{@link FluentComparableAssertion#isBetween(Comparable,Comparable) isBetween(Comparable,Comparable)} 041 * </ul> 042 * <li class='jc'>{@link FluentObjectAssertion} 043 * <ul class='javatreec'> 044 * <li class='jm'>{@link FluentObjectAssertion#isExists() isExists()} 045 * <li class='jm'>{@link FluentObjectAssertion#is(Object) is(Object)} 046 * <li class='jm'>{@link FluentObjectAssertion#is(Predicate) is(Predicate)} 047 * <li class='jm'>{@link FluentObjectAssertion#isNot(Object) isNot(Object)} 048 * <li class='jm'>{@link FluentObjectAssertion#isAny(Object...) isAny(Object...)} 049 * <li class='jm'>{@link FluentObjectAssertion#isNotAny(Object...) isNotAny(Object...)} 050 * <li class='jm'>{@link FluentObjectAssertion#isNull() isNull()} 051 * <li class='jm'>{@link FluentObjectAssertion#isNotNull() isNotNull()} 052 * <li class='jm'>{@link FluentObjectAssertion#isString(String) isString(String)} 053 * <li class='jm'>{@link FluentObjectAssertion#isJson(String) isJson(String)} 054 * <li class='jm'>{@link FluentObjectAssertion#isSame(Object) isSame(Object)} 055 * <li class='jm'>{@link FluentObjectAssertion#isSameJsonAs(Object) isSameJsonAs(Object)} 056 * <li class='jm'>{@link FluentObjectAssertion#isSameSortedJsonAs(Object) isSameSortedJsonAs(Object)} 057 * <li class='jm'>{@link FluentObjectAssertion#isSameSerializedAs(Object, WriterSerializer) isSameSerializedAs(Object, WriterSerializer)} 058 * <li class='jm'>{@link FluentObjectAssertion#isType(Class) isType(Class)} 059 * <li class='jm'>{@link FluentObjectAssertion#isExactType(Class) isExactType(Class)} 060 * </ul> 061 * </ul> 062 * 063 * <h5 class='section'>Transform Methods:</h5> 064 * <p> 065 * <ul class='javatree'> 066 * <li class='jc'>{@link FluentLongAssertion} 067 * <ul class='javatreec'> 068 * <li class='jm'>{@link FluentLongAssertion#asInteger() asInteger()} 069 * </ul> 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 > juneau-assertions > Overview</a> 097 * </ul> 098 */ 099@FluentSetters(returns="LongAssertion") 100public class LongAssertion extends FluentLongAssertion<LongAssertion> { 101 102 //----------------------------------------------------------------------------------------------------------------- 103 // Static 104 //----------------------------------------------------------------------------------------------------------------- 105 106 /** 107 * Static creator. 108 * 109 * @param value 110 * The object being tested. 111 * <br>Can be <jk>null</jk>. 112 * @return A new assertion object. 113 */ 114 public static LongAssertion create(Long value) { 115 return new LongAssertion(value); 116 } 117 118 //----------------------------------------------------------------------------------------------------------------- 119 // Instance 120 //----------------------------------------------------------------------------------------------------------------- 121 122 /** 123 * Constructor. 124 * 125 * @param value 126 * The object being tested. 127 * <br>Can be <jk>null</jk>. 128 */ 129 public LongAssertion(Long value) { 130 super(value, null); 131 } 132 133 //----------------------------------------------------------------------------------------------------------------- 134 // Fluent setters 135 //----------------------------------------------------------------------------------------------------------------- 136 137 // <FluentSetters> 138 139 @Override /* GENERATED - org.apache.juneau.assertions.Assertion */ 140 public LongAssertion setMsg(String msg, Object...args) { 141 super.setMsg(msg, args); 142 return this; 143 } 144 145 @Override /* GENERATED - org.apache.juneau.assertions.Assertion */ 146 public LongAssertion setOut(PrintStream value) { 147 super.setOut(value); 148 return this; 149 } 150 151 @Override /* GENERATED - org.apache.juneau.assertions.Assertion */ 152 public LongAssertion setSilent() { 153 super.setSilent(); 154 return this; 155 } 156 157 @Override /* GENERATED - org.apache.juneau.assertions.Assertion */ 158 public LongAssertion setStdOut() { 159 super.setStdOut(); 160 return this; 161 } 162 163 @Override /* GENERATED - org.apache.juneau.assertions.Assertion */ 164 public LongAssertion setThrowable(Class<? extends java.lang.RuntimeException> value) { 165 super.setThrowable(value); 166 return this; 167 } 168 169 // </FluentSetters> 170}