Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.epam.web.matcher.base.IChecker Maven / Gradle / Ivy
package com.epam.web.matcher.base;
/*
* Copyright 2004-2016 EPAM Systems
*
* This file is part of JDI project.
*
* JDI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* JDI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JDI. If not, see .
*/
import com.epam.commons.linqinterfaces.JAction;
import com.epam.commons.map.MapArray;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.BooleanSupplier;
import java.util.function.Supplier;
import static com.epam.commons.LinqUtils.toIntArray;
import static com.epam.commons.ReflectionUtils.getFields;
import static java.util.Arrays.asList;
/**
* Created by Roman_Iovlev on 8/28/2015.
*/
public interface IChecker {
void areEquals(T actual, T expected, String failMessage);
default void areEquals(T actual, T expected) { areEquals(actual, expected, null); }
void matches(String actual, String regEx, String failMessage);
default void matches(String actual, String expected) { matches(actual, expected, null); }
void contains(String actual, String expected, String failMessage);
default void contains(String actual, String expected) { contains(actual, expected, null); }
void isTrue(Boolean condition, String failMessage);
default void isTrue(Boolean condition) { isTrue(condition, null); }
void isFalse(Boolean condition, String failMessage);
default void isFalse(Boolean condition) { isFalse(condition, null); }
void throwException(String actionName, JAction action, Class exceptionClass, String exceptionText);
default void throwException(String actionName, JAction action, String exceptionText) {
throwException(action, null, exceptionText);
}
default void throwException(String actionName, JAction action, Class exceptionClass) {
throwException(action, exceptionClass, "");
}
void throwException(JAction action, Class exceptionClass, String exceptionText);
default void throwException(JAction action, String exceptionText) {
throwException(action, null, exceptionText);
}
default void throwException(JAction action, Class exceptionClass) {
throwException(action, exceptionClass, "");
}
void hasNoExceptions(String actionName, JAction action);
void hasNoExceptions(JAction action);
void isEmpty(Object obj, String failMessage);
default void isEmpty(Object obj) { isEmpty(obj, null); }
void isNotEmpty(Object obj, String failMessage);
default void isNotEmpty(Object obj) { isNotEmpty(obj, null); }
void areDifferent(T actual, T expected, String failMessage);
default void areDifferent(T actual, T expected) { areDifferent(actual, expected, null); }
void listEquals(Collection actual, Collection expected, String failMessage);
default void listEquals(Collection actual, Collection expected) { listEquals(actual, expected, null); }
default void listContains(Collection actual, T expected, String failMessage) { listContains(actual, asList(expected), failMessage);};
default void listContains(Collection actual, T expected) { listContains(actual, asList(expected), null); }
void listContains(Collection actual, Collection expected, String failMessage);
default void listContains(Collection actual, Collection expected) { listContains(actual, expected, null); }
void arrayEquals(T actual, T expected, String failMessage);
default void arrayEquals(T actual, T expected) {
arrayEquals(actual, expected, null);
}
void entityIncludeMapArray(T entity, MapArray actual, String failMessage);
default void entityIncludeMapArray(T entity, MapArray expected) {
entityIncludeMapArray(entity, expected, null);
}
void entityEqualsToMapArray(T entity, MapArray expected, String failMessage);
default void entityEqualsToMapArray(T entity, MapArray expected) {
entityEqualsToMapArray(entity, expected, null);
}
void entityIncludeMap(T entity, Map expected, String failMessage);
default void entityIncludeMap(T entity, Map expected) {
entityIncludeMap(entity, expected, null);
}
void entityEqualsToMap(T entity, Map expected, String failMessage);
default void entityEqualsToMap(T entity, Map expected) {
entityEqualsToMap(entity, expected, null);
}
void isSortedByAsc(int[] array, String failMessage);
default void isSortedByAsc(int[] array) {
isSortedByAsc(array, null);
}
default void isSortedByAsc(List array, String failMessage) {
isSortedByAsc(toIntArray(array), failMessage);
}
default void isSortedByAsc(List array) {
isSortedByAsc(toIntArray(array));
}
void isSortedByDesc(int[] array, String failMessage);
default void isSortedByDesc(int[] array) {
isSortedByDesc(array, null);
}
default void isSortedByDesc(List array, String failMessage) {
isSortedByDesc(toIntArray(array), failMessage);
}
default void isSortedByDesc(List array) {
isSortedByDesc(toIntArray(array));
}
void areEquals(Supplier actual, T expected, String failMessage);
void areEquals(Supplier actual, T expected);
void matches(Supplier actual, String regEx, String failMessage);
default void matches(Supplier actual, String regEx) {
matches(actual, regEx, null);
}
void contains(Supplier actual, String expected, String failMessage);
default void contains(Supplier actual, String expected) {
contains(actual, expected, null);
}
void isTrue(BooleanSupplier condition, String failMessage);
default void isTrue(BooleanSupplier condition) {
isTrue(condition, null);
}
void isFalse(BooleanSupplier condition, String failMessage);
default void isFalse(BooleanSupplier condition) {
isFalse(condition, null);
}
void isEmpty(Supplier obj, String failMessage);
default void isEmpty(Supplier obj) {
isEmpty(obj, null);
}
void isNotEmpty(Supplier obj, String failMessage);
default void isNotEmpty(Supplier obj) {
isNotEmpty(obj, null);
}
void areSame(Supplier actual, T expected, String failMessage);
default void areSame(Supplier actual, T expected) {
areSame(actual, expected, null);
}
void areDifferent(Supplier actual, T expected, String failMessage);
default void areDifferent(Supplier actual, T expected) {
areDifferent(actual, expected, null);
}
void listEquals(Supplier> actual, Collection expected, String failMessage);
default void listEquals(Supplier> actual, Collection expected) {
listEquals(actual, expected, null);
}
void arrayEquals(Supplier actual, T expected, String failMessage);
default void arrayEquals(Supplier actual, T expected) {
arrayEquals(actual, expected, null);
}
default void entitiesAreEquals(T actual, T expected, String failMessage) {
listEquals(getFields(actual.getClass()), getFields(expected.getClass()), failMessage);
}
default void entitiesAreEquals(T actual, T expected) {
entitiesAreEquals(actual, expected, null);
}
void entityIncludeMapArray(T entity, Supplier> expected, String failMessage);
default void entityIncludeMapArray(T entity, Supplier> expected) {
entityIncludeMapArray(entity, expected, null);
}
void entityEqualsToMapArray(T entity, Supplier> expected, String failMessage);
default void entityEqualsToMapArray(T entity, Supplier> expected) {
entityEqualsToMapArray(entity, expected, null);
}
void entityIncludeMap(T entity, Supplier> expected, String failMessage);
default void entityIncludeMap(T entity, Supplier> expected) {
entityIncludeMap(entity, expected, null);
}
void entityEqualsToMap(T entity, Supplier> expected, String failMessage);
default void entityEqualsToMap(T entity, Supplier> expected) {
entityEqualsToMap(entity, expected, null);
}
BaseMatcher.ListChecker eachElementOf(Collection list);
BaseMatcher.ListChecker eachElementOf(T[] array);
}