All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.juneau.assertions.ArrayAssertion Maven / Gradle / Ivy

The newest version!
// ***************************************************************************************************************************
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
// * with the License.  You may obtain a copy of the License at                                                              *
// *                                                                                                                         *
// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
// *                                                                                                                         *
// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
// * specific language governing permissions and limitations under the License.                                              *
// ***************************************************************************************************************************
package org.apache.juneau.assertions;

import java.io.*;
import java.util.*;
import java.util.function.*;

import org.apache.juneau.internal.*;
import org.apache.juneau.serializer.*;

/**
 * Used for assertion calls against arrays.
 *
 * 
Example:
*

* import static org.apache.juneau.assertions.Assertions.*; * * String[] array = {"foo"}; * assertArray(array).exists().isSize(1); *

* *
Test Methods
*
    *
  • {@link FluentArrayAssertion} *
      *
    • {@link FluentArrayAssertion#isHas(Object[]) isHas(Object[])} *
    • {@link FluentArrayAssertion#is(Predicate) is(Predicate)} *
    • {@link FluentArrayAssertion#isAny(Predicate) isAny(Predicate)} *
    • {@link FluentArrayAssertion#isAll(Predicate) isAll(Predicate)} *
    • {@link FluentArrayAssertion#isEmpty() isEmpty()} *
    • {@link FluentArrayAssertion#isNotEmpty() isNotEmpty()} *
    • {@link FluentArrayAssertion#isSize(int) isSize(int)} *
    • {@link FluentArrayAssertion#isContains(Object) isContains(Object)} *
    • {@link FluentArrayAssertion#isNotContains(Object) isNotContains(Object)} *
    *
  • {@link FluentObjectAssertion} *
      *
    • {@link FluentObjectAssertion#isExists() isExists()} *
    • {@link FluentObjectAssertion#is(Object) is(Object)} *
    • {@link FluentObjectAssertion#is(Predicate) is(Predicate)} *
    • {@link FluentObjectAssertion#isNot(Object) isNot(Object)} *
    • {@link FluentObjectAssertion#isAny(Object...) isAny(Object...)} *
    • {@link FluentObjectAssertion#isNotAny(Object...) isNotAny(Object...)} *
    • {@link FluentObjectAssertion#isNull() isNull()} *
    • {@link FluentObjectAssertion#isNotNull() isNotNull()} *
    • {@link FluentObjectAssertion#isString(String) isString(String)} *
    • {@link FluentObjectAssertion#isJson(String) isJson(String)} *
    • {@link FluentObjectAssertion#isSame(Object) isSame(Object)} *
    • {@link FluentObjectAssertion#isSameJsonAs(Object) isSameJsonAs(Object)} *
    • {@link FluentObjectAssertion#isSameSortedJsonAs(Object) isSameSortedJsonAs(Object)} *
    • {@link FluentObjectAssertion#isSameSerializedAs(Object, WriterSerializer) isSameSerializedAs(Object, WriterSerializer)} *
    • {@link FluentObjectAssertion#isType(Class) isType(Class)} *
    • {@link FluentObjectAssertion#isExactType(Class) isExactType(Class)} *
    *
* *
Transform Methods
*

*

    *
  • {@link FluentArrayAssertion} *
      *
    • {@link FluentArrayAssertion#asStrings() asStrings()} *
    • {@link FluentArrayAssertion#asStrings(Function) asStrings(Function)} *
    • {@link FluentArrayAssertion#asCdl() asCdl()} *
    • {@link FluentArrayAssertion#asCdl(Function) asCdl(Function)} *
    • {@link FluentArrayAssertion#asBeanList() asBeanList()} *
    • {@link FluentArrayAssertion#asItem(int) asItem(int)} *
    • {@link FluentArrayAssertion#asSorted() asSorted()} *
    • {@link FluentArrayAssertion#asSorted(Comparator) asSorted(Comparator)} *
    *
  • {@link FluentObjectAssertion} *
      *
    • {@link FluentObjectAssertion#asString() asString()} *
    • {@link FluentObjectAssertion#asString(WriterSerializer) asString(WriterSerializer)} *
    • {@link FluentObjectAssertion#asString(Function) asString(Function)} *
    • {@link FluentObjectAssertion#asJson() asJson()} *
    • {@link FluentObjectAssertion#asJsonSorted() asJsonSorted()} *
    • {@link FluentObjectAssertion#asTransformed(Function) asApplied(Function)} *
    • {@link FluentObjectAssertion#asAny() asAny()} *
    *
* *
Configuration Methods
*

*

    *
  • {@link Assertion} *
      *
    • {@link Assertion#setMsg(String, Object...) setMsg(String, Object...)} *
    • {@link Assertion#setOut(PrintStream) setOut(PrintStream)} *
    • {@link Assertion#setSilent() setSilent()} *
    • {@link Assertion#setStdOut() setStdOut()} *
    • {@link Assertion#setThrowable(Class) setThrowable(Class)} *
    *
* *
See Also:
* * * @param The element type. */ @FluentSetters(returns="ArrayAssertion") public class ArrayAssertion extends FluentArrayAssertion> { //----------------------------------------------------------------------------------------------------------------- // Static //----------------------------------------------------------------------------------------------------------------- /** * Static creator. * * @param The element type. * @param value * The object being tested. *
Can be null. * @return A new assertion object. */ public static ArrayAssertion create(E[] value) { return new ArrayAssertion<>(value); } //----------------------------------------------------------------------------------------------------------------- // Instance //----------------------------------------------------------------------------------------------------------------- /** * Constructor. * * @param value * The object being tested. *
Can be null. */ public ArrayAssertion(E[] value) { super(value, null); } //----------------------------------------------------------------------------------------------------------------- // Fluent setters //----------------------------------------------------------------------------------------------------------------- // @Override /* GENERATED - org.apache.juneau.assertions.Assertion */ public ArrayAssertion setMsg(String msg, Object...args) { super.setMsg(msg, args); return this; } @Override /* GENERATED - org.apache.juneau.assertions.Assertion */ public ArrayAssertion setOut(PrintStream value) { super.setOut(value); return this; } @Override /* GENERATED - org.apache.juneau.assertions.Assertion */ public ArrayAssertion setSilent() { super.setSilent(); return this; } @Override /* GENERATED - org.apache.juneau.assertions.Assertion */ public ArrayAssertion setStdOut() { super.setStdOut(); return this; } @Override /* GENERATED - org.apache.juneau.assertions.Assertion */ public ArrayAssertion setThrowable(Class value) { super.setThrowable(value); return this; } // }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy