proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/Assumptions.java | AssumptionMethodInterceptor | intercept | class AssumptionMethodInterceptor {
@RuntimeType
public static Object intercept(@This AbstractAssert<?, ?> assertion, @SuperCall Callable<Object> proxy) throws Exception {<FILL_FUNCTION_BODY>}
} |
try {
Object result = proxy.call();
if (result != assertion && result instanceof AbstractAssert) {
return asAssumption((AbstractAssert<?, ?>) result).withAssertionState(assertion);
}
return result;
} catch (AssertionError e) {
throw assumptionNotMet(e);
... | 60 | 86 | 146 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/AtomicBooleanAssert.java | AtomicBooleanAssert | usingComparator | class AtomicBooleanAssert extends AbstractAssert<AtomicBooleanAssert, AtomicBoolean> {
@VisibleForTesting
Booleans booleans = Booleans.instance();
public AtomicBooleanAssert(AtomicBoolean actual) {
super(actual, AtomicBooleanAssert.class);
}
/**
* Verifies that the actual atomic value is true.
* ... |
throw new UnsupportedOperationException("custom Comparator is not supported for AtomicBoolean comparison");
| 731 | 25 | 756 | <methods>public ASSERT asInstanceOf(InstanceOfAssertFactory<?,ASSERT>) ,public AbstractListAssert<?,List<?>,java.lang.Object,ObjectAssert<java.lang.Object>> asList() ,public AbstractStringAssert<?> asString() ,public org.assertj.core.api.AtomicBooleanAssert describedAs(org.assertj.core.description.Description) ,public ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/AtomicMarkableReferenceAssert.java | AtomicMarkableReferenceAssert | isNotMarked | class AtomicMarkableReferenceAssert<VALUE>
extends AbstractAtomicReferenceAssert<AtomicMarkableReferenceAssert<VALUE>, VALUE, AtomicMarkableReference<VALUE>> {
public AtomicMarkableReferenceAssert(AtomicMarkableReference<VALUE> actual) {
super(actual, AtomicMarkableReferenceAssert.class);
}
/**
* Ver... |
boolean marked = actual.isMarked();
if (marked) throwAssertionError(shouldNotBeMarked(actual));
return this;
| 737 | 39 | 776 | <methods>public AtomicMarkableReferenceAssert<VALUE> hasReference(VALUE) <variables> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/AtomicReferenceAssert.java | AtomicReferenceAssert | hasValueSatisfying | class AtomicReferenceAssert<V> extends AbstractAssert<AtomicReferenceAssert<V>, AtomicReference<V>> {
public AtomicReferenceAssert(AtomicReference<V> actual) {
super(actual, AtomicReferenceAssert.class);
}
/**
* Verifies that the atomic under test has the given value.
* <p>
* Example:
* <pre><co... |
requireNonNull(requirements, "The Consumer<? super V> expressing the assertions requirements must not be null");
isNotNull();
requirements.accept(actual.get());
return myself;
| 1,946 | 51 | 1,997 | <methods>public ASSERT asInstanceOf(InstanceOfAssertFactory<?,ASSERT>) ,public AbstractListAssert<?,List<?>,java.lang.Object,ObjectAssert<java.lang.Object>> asList() ,public AbstractStringAssert<?> asString() ,public AtomicReferenceAssert<V> describedAs(org.assertj.core.description.Description) ,public java.lang.String... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/AtomicStampedReferenceAssert.java | AtomicStampedReferenceAssert | hasStamp | class AtomicStampedReferenceAssert<VALUE>
extends AbstractAtomicReferenceAssert<AtomicStampedReferenceAssert<VALUE>, VALUE, AtomicStampedReference<VALUE>> {
public AtomicStampedReferenceAssert(AtomicStampedReference<VALUE> actual) {
super(actual, AtomicStampedReferenceAssert.class);
}
/**
* Verifies ... |
int timestamp = actual.getStamp();
if (timestamp != expectedStamp) throwAssertionError(shouldHaveStamp(actual, expectedStamp));
return this;
| 565 | 46 | 611 | <methods>public AtomicStampedReferenceAssert<VALUE> hasReference(VALUE) <variables> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/ClassBasedNavigableIterableAssert.java | ClassBasedNavigableIterableAssert | buildAssert | class ClassBasedNavigableIterableAssert<SELF extends ClassBasedNavigableIterableAssert<SELF, ACTUAL, ELEMENT, ELEMENT_ASSERT>,
ACTUAL extends Iterable<? extends ELEMENT>,
ELEMENT,
... |
try {
Constructor<?>[] declaredConstructors = assertClass.getDeclaredConstructors();
// find a matching Assert constructor for E or one of its subclass.
for (Constructor<?> constructor : declaredConstructors) {
if (constructor.getParameterCount() == 1 && constructor.getParameterTypes()[0]... | 498 | 212 | 710 | <methods>public SELF allMatch(Predicate<? super ELEMENT>) ,public SELF allMatch(Predicate<? super ELEMENT>, java.lang.String) ,public SELF allSatisfy(Consumer<? super ELEMENT>) ,public SELF allSatisfy(ThrowingConsumer<? super ELEMENT>) ,public SELF anyMatch(Predicate<? super ELEMENT>) ,public SELF anySatisfy(Consumer<?... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/ClassBasedNavigableListAssert.java | ClassBasedNavigableListAssert | newAbstractIterableAssert | class ClassBasedNavigableListAssert<SELF extends ClassBasedNavigableListAssert<SELF, ACTUAL, ELEMENT, ELEMENT_ASSERT>,
ACTUAL extends List<? extends ELEMENT>,
ELEMENT,
ELEMENT_ASSERT exten... |
checkArgument(iterable instanceof List, "Expecting %s to be a List", iterable);
return (SELF) new ClassBasedNavigableListAssert<>((List<? extends ELEMENT>) iterable, assertClass);
| 658 | 59 | 717 | <methods>public transient SELF as(java.lang.String, java.lang.Object[]) ,public SELF as(org.assertj.core.description.Description) ,public SELF contains(ELEMENT, org.assertj.core.data.Index) ,public SELF describedAs(org.assertj.core.description.Description) ,public transient SELF describedAs(java.lang.String, java.lang.... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/ClassLoadingStrategyFactory.java | ClassLoadingStrategyFactory | classLoadingStrategy | class ClassLoadingStrategyFactory {
private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
private static final Method PRIVATE_LOOKUP_IN;
// Class loader of AssertJ
static final ClassLoader ASSERTJ_CLASS_LOADER = ClassLoadingStrategyFactory.class.getClassLoader();
static {
Method pri... |
// Use ClassLoader of assertion class to allow ByteBuddy to always find it.
// This is needed in an OSGi runtime when a custom assertion class is
// defined in a different OSGi bundle.
ClassLoader assertClassLoader = assertClass.getClassLoader();
if (assertClassLoader != ASSERTJ_CLASS_LOADER) {
... | 885 | 347 | 1,232 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/ComparatorFactory.java | ComparatorFactory | floatComparatorWithPrecision | class ComparatorFactory {
public static final ComparatorFactory INSTANCE = new ComparatorFactory();
public Comparator<Double> doubleComparatorWithPrecision(double precision) {
// can't use <> with anonymous class in java 8
return new Comparator<Double>() {
@Override
public int compare(Double ... |
// can't use <> with anonymous class in java 8
return new Comparator<Float>() {
@Override
public int compare(Float float1, Float float2) {
Floats floats = Floats.instance();
if (floats.isNanOrInfinite(precision)) {
throw new IllegalArgumentException("Precision should not ... | 722 | 293 | 1,015 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/Condition.java | Condition | toString | class Condition<T> implements Descriptable<Condition<T>> {
/**
* Describes the condition status after being evaluated.
*/
public enum Status {
SUCCESS("[✓]"), FAIL("[✗]");
public final String label;
Status(String label) {
this.label = label;
}
@Override
public String toString... |
// call description() as Condition description could be dynamic and shoud be reevaluated
return description().value();
| 1,253 | 29 | 1,282 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/DefaultAssertionErrorCollector.java | DefaultAssertionErrorCollector | collectAssertionError | class DefaultAssertionErrorCollector implements AssertionErrorCollector {
// Marking this field as volatile doesn't ensure complete thread safety
// (mutual exclusion, race-free behavior), but guarantees eventual visibility
private volatile boolean wasSuccess = true;
private final List<AssertionError> collecte... |
if (delegate == null) {
collectedAssertionErrors.add(error);
wasSuccess = false;
} else {
delegate.collectAssertionError(error);
}
callbacks.forEach(callback -> callback.onAssertionErrorCollected(error));
| 1,391 | 72 | 1,463 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/ErrorCollector.java | ErrorCollector | intercept | class ErrorCollector {
public static final String FIELD_NAME = "errorCollector";
private static final String INTERCEPT_METHOD_NAME = "intercept";
private static final String CLASS_NAME = ErrorCollector.class.getName();
private AssertionErrorCollector assertionErrorCollector;
ErrorCollector(AssertionErrorC... |
try {
Object result = proxy.call();
errorCollector.succeeded();
return result;
} catch (AssertionError assertionError) {
if (isNestedErrorCollectorProxyCall()) {
// let the most outer call handle the assertion error
throw assertionError;
}
errorCollector.addE... | 489 | 171 | 660 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/FactoryBasedNavigableListAssert.java | FactoryBasedNavigableListAssert | newAbstractIterableAssert | class FactoryBasedNavigableListAssert<SELF extends FactoryBasedNavigableListAssert<SELF, ACTUAL, ELEMENT, ELEMENT_ASSERT>,
ACTUAL extends List<? extends ELEMENT>,
ELEMENT,
ELEMENT_AS... |
checkArgument(iterable instanceof List, "Expecting %s to be a List", iterable);
return (SELF) new FactoryBasedNavigableListAssert<>((List<? extends ELEMENT>) iterable,
FactoryBasedNavigableListAssert.class,
... | 438 | 75 | 513 | <methods>public transient SELF as(java.lang.String, java.lang.Object[]) ,public SELF as(org.assertj.core.description.Description) ,public SELF contains(ELEMENT, org.assertj.core.data.Index) ,public SELF describedAs(org.assertj.core.description.Description) ,public transient SELF describedAs(java.lang.String, java.lang.... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/Fail.java | Fail | fail | class Fail {
/**
* Sets whether we remove elements related to AssertJ from assertion error stack trace.
*
* @param removeAssertJRelatedElementsFromStackTrace flag.
*/
public static void setRemoveAssertJRelatedElementsFromStackTrace(boolean removeAssertJRelatedElementsFromStackTrace) {
Failures.inst... |
// pass an empty string because passing null results in a "null" error message.
return fail("");
| 1,458 | 28 | 1,486 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/SoftAssertionsStatement.java | SoftAssertionsStatement | build | class SoftAssertionsStatement {
private SoftAssertionsProvider soft;
private AssertionErrorCreator assertionErrorCreator = new AssertionErrorCreator();
private SoftAssertionsStatement(SoftAssertionsProvider soft) {
this.soft = soft;
}
public static Statement softAssertionsStatement(SoftAssertionsProvid... |
// no lambda to keep java 6 compatibility
return new Statement() {
@Override
public void evaluate() throws Throwable {
baseStatement.evaluate();
List<AssertionError> errors = soft.assertionErrorsCollected();
if (errors.isEmpty()) return;
// tests assertions raised so... | 141 | 217 | 358 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/SoftThrowableTypeAssert.java | SoftThrowableTypeAssert | checkThrowableType | class SoftThrowableTypeAssert<T extends Throwable> extends ThrowableTypeAssert<T> {
private final SoftAssertionsProvider softAssertionsProvider;
/**
* Default constructor.
*
* @param throwableType class representing the target (expected) exception
* @param softAssertionsProvider the soft assertion ins... |
try {
super.checkThrowableType(throwable);
} catch (AssertionError error) {
this.softAssertionsProvider.collectAssertionError(error);
}
| 280 | 49 | 329 | <methods>public void <init>(Class<? extends T>) ,public ThrowableTypeAssert<T> describedAs(org.assertj.core.description.Description) ,public ThrowableAssertAlternative<T> isThrownBy(org.assertj.core.api.ThrowableAssert.ThrowingCallable) <variables>protected org.assertj.core.description.Description description,protected... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/TemporalAssert.java | TemporalAssert | parse | class TemporalAssert extends AbstractTemporalAssert<TemporalAssert, Temporal> {
public TemporalAssert(Temporal actual) {
super(actual, TemporalAssert.class);
}
@Override
public Temporal parse(String temporalAsString) {<FILL_FUNCTION_BODY>}
@Override
public TemporalAssert isCloseTo(String otherAsStrin... |
throw new UnsupportedOperationException("This is not supported because there is no unique String representation of Temporal, this is available in concrete assertion temporal class like ZonedDateTimeAssert");
| 164 | 42 | 206 | <methods>public org.assertj.core.api.TemporalAssert isCloseTo(java.time.temporal.Temporal, TemporalOffset<? super java.time.temporal.Temporal>) ,public org.assertj.core.api.TemporalAssert isCloseTo(java.lang.String, TemporalOffset<? super java.time.temporal.Temporal>) ,public org.assertj.core.api.TemporalAssert usingCo... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/ThrowableAssert.java | ThrowableAssert | catchThrowable | class ThrowableAssert<ACTUAL extends Throwable> extends AbstractThrowableAssert<ThrowableAssert<ACTUAL>, ACTUAL> {
public interface ThrowingCallable {
void call() throws Throwable;
}
public ThrowableAssert(ACTUAL actual) {
super(actual, ThrowableAssert.class);
}
public <V> ThrowableAssert(Callable<... |
try {
shouldRaiseThrowable.call();
} catch (Throwable throwable) {
return throwable;
}
return null;
| 494 | 42 | 536 | <methods>public AbstractThrowableAssert<?,?> cause() ,public void doesNotThrowAnyException() ,public AbstractThrowableAssert<?,?> getCause() ,public AbstractThrowableAssert<?,?> getRootCause() ,public ThrowableAssert<ACTUAL> hasCause(java.lang.Throwable) ,public ThrowableAssert<ACTUAL> hasCauseExactlyInstanceOf(Class<?... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/ThrowableTypeAssert.java | ThrowableTypeAssert | isThrownBy | class ThrowableTypeAssert<T extends Throwable> implements Descriptable<ThrowableTypeAssert<T>> {
@VisibleForTesting
protected final Class<? extends T> expectedThrowableType;
protected Description description;
/**
* Default constructor.
*
* @param throwableType class representing the target (expected... |
Throwable throwable = ThrowableAssert.catchThrowable(throwingCallable);
checkThrowableType(throwable);
@SuppressWarnings("unchecked")
T castThrowable = (T) throwable;
return buildThrowableTypeAssert(castThrowable).as(description);
| 463 | 77 | 540 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/WritableAssertionInfo.java | WritableAssertionInfo | overridingErrorMessage | class WritableAssertionInfo implements AssertionInfo {
private static final String EMPTY_STRING = "";
private Supplier<String> overridingErrorMessageSupplier;
private String overridingErrorMessage;
private Description description;
private Representation representation;
public WritableAssertionInfo(Represe... |
checkState(overridingErrorMessage == null,
"An error message has already been set with overridingErrorMessage(String newErrorMessage)");
overridingErrorMessageSupplier = supplier;
| 1,213 | 49 | 1,262 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/junit/jupiter/SoftAssertionsExtension.java | ThreadLocalErrorCollector | resolveParameter | class ThreadLocalErrorCollector implements AssertionErrorCollector {
InheritableThreadLocal<AssertionErrorCollector> threadLocal = new InheritableThreadLocal<>();
@Override
public Optional<AssertionErrorCollector> getDelegate() {
return Optional.of(threadLocal.get());
}
@Override
public... |
// The parameter type is guaranteed to be an instance of SoftAssertionsProvider
@SuppressWarnings("unchecked")
Class<? extends SoftAssertionsProvider> concreteSoftAssertionsProviderType = (Class<? extends SoftAssertionsProvider>) parameterContext.getParameter()
... | 1,377 | 120 | 1,497 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/junit/jupiter/SoftlyExtension.java | SoftlyExtension | afterTestExecution | class SoftlyExtension implements AfterTestExecutionCallback, TestInstancePostProcessor {
private static final Namespace SOFTLY_EXTENSION_NAMESPACE = Namespace.create(SoftlyExtension.class);
@Override
public void postProcessTestInstance(Object testInstance, ExtensionContext extensionContext) throws Exception {
... |
SoftAssertions softAssertions = getStore(extensionContext).remove(SoftlyExtension.class, SoftAssertions.class);
Optional<ExtensionContext> currentContext = Optional.of(extensionContext);
// try to find SoftAssertions in the hierarchy of ExtensionContexts starting with the current one.
while (softAssert... | 702 | 185 | 887 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/recursive/assertion/DefaultRecursiveAssertionIntrospectionStrategy.java | DefaultRecursiveAssertionIntrospectionStrategy | getFieldType | class DefaultRecursiveAssertionIntrospectionStrategy implements RecursiveAssertionIntrospectionStrategy {
@Override
public List<RecursiveAssertionNode> getChildNodesOf(Object node) {
return getDeclaredFieldsIncludingInherited(node.getClass()).stream()
... |
try {
Optional<Field> potentialField = stream(objectClass.getDeclaredFields()).filter(field -> fieldName.equals(field.getName()))
.findAny();
if (potentialField.isPresent()) return potentialField.get().getType();
Class<... | 332 | 181 | 513 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/recursive/assertion/RecursiveAssertionNode.java | RecursiveAssertionNode | equals | class RecursiveAssertionNode {
public final Object value;
public final String name;
public final Class<?> type;
public RecursiveAssertionNode(Object value, String name, Class<?> type) {
this.value = value;
this.name = name;
this.type = type;
}
@Override
public String toString() {
return ... |
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RecursiveAssertionNode that = (RecursiveAssertionNode) o;
return Objects.equals(value, that.value) && Objects.equals(name, that.name) && Objects.equals(type, that.type);
| 201 | 93 | 294 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/recursive/comparison/ComparingNormalizedFields.java | ComparingNormalizedFields | getChildrenNodeNamesOf | class ComparingNormalizedFields implements RecursiveComparisonIntrospectionStrategy {
private static final String NO_FIELD_FOUND = "Unable to find field in %s, fields tried: %s and %s";
// original field name <-> normalized field name by node
private final Map<Object, Map<String, String>> originalFieldNamesByNo... |
if (node == null) return new HashSet<>();
Set<String> fieldsNames = Objects.getFieldsNames(node.getClass());
// we normalize fields so that we can compare actual and expected, for example if actual has a firstName field and expected
// a first_name field, we won't find firstName in expected unless we n... | 1,548 | 144 | 1,692 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/recursive/comparison/ComparingProperties.java | ComparingProperties | gettersOf | class ComparingProperties implements RecursiveComparisonIntrospectionStrategy {
public static final ComparingProperties COMPARING_PROPERTIES = new ComparingProperties();
private static final String GET_PREFIX = "get";
private static final String IS_PREFIX = "is";
// use ConcurrentHashMap in case this strateg... |
return stream(clazz.getMethods()).filter(method -> !isInJavaLangPackage(method.getDeclaringClass()))
.filter(method -> !isStatic(method))
.filter(ComparingProperties::isGetter)
.collect(toCollection(Linke... | 711 | 76 | 787 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/recursive/comparison/ComparingSnakeOrCamelCaseFields.java | ComparingSnakeOrCamelCaseFields | normalizeAcronyms | class ComparingSnakeOrCamelCaseFields extends ComparingNormalizedFields {
public static final ComparingSnakeOrCamelCaseFields COMPARING_SNAKE_OR_CAMEL_CASE_FIELDS = new ComparingSnakeOrCamelCaseFields();
/**
* Transforms snake case field names into camel case (leave camel case fields as is).
* <p>
* For ... |
for (int i = 0; i < name.length(); i++) {
if (!isUpperCase(name.charAt(i))) continue;
int j = i + 1;
while (j < name.length() && isUpperCase(name.charAt(j))) {
j++;
}
return name.substring(0, i + 1)
+ name.substring(i + 1, j).toLowerCase()
+ normalize... | 367 | 138 | 505 | <methods>public non-sealed void <init>() ,public java.lang.Object getChildNodeValue(java.lang.String, java.lang.Object) ,public Set<java.lang.String> getChildrenNodeNamesOf(java.lang.Object) ,public java.lang.String getDescription() <variables>private static final java.lang.String NO_FIELD_FOUND,private final Map<Class... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/recursive/comparison/ComparisonDifference.java | ComparisonDifference | fieldPathDescription | class ComparisonDifference implements Comparable<ComparisonDifference> {
// ELEMENT_WITH_INDEX_PATTERN should match [0] or [123] but not name[0] or [0].name, explanation:
// - ^ represents the start of the string in a regex
// - \[ represents [ in a regex, need another \ to escape it in a java string
// - d+ a... |
if (concatenatedPath.isEmpty()) return TOP_LEVEL_OBJECTS;
if (concatenatedPath.matches(TOP_LEVEL_ELEMENT_PATTERN)) return format(TOP_LEVEL_ELEMENTS, extractIndex(concatenatedPath));
return format(FIELD, concatenatedPath);
| 1,542 | 81 | 1,623 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/recursive/comparison/ComparisonKeyDifference.java | ComparisonKeyDifference | multiLineDescription | class ComparisonKeyDifference extends ComparisonDifference {
static final String TEMPLATE_FOR_KEY_DIFFERENCE = "map key difference:%n" +
"- actual key : %s%n" +
"- expected key: %s";
final Object actualKey;
... |
UnambiguousRepresentation unambiguousRepresentation = new UnambiguousRepresentation(representation, actual, expected);
UnambiguousRepresentation unambiguousKeyRepresentation = new UnambiguousRepresentation(representation, actualKey,
... | 221 | 167 | 388 | <methods>public void <init>(org.assertj.core.api.recursive.comparison.DualValue) ,public void <init>(org.assertj.core.api.recursive.comparison.DualValue, java.lang.String) ,public void <init>(org.assertj.core.api.recursive.comparison.DualValue, java.lang.String, java.lang.String) ,public int compareTo(org.assertj.core.... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/recursive/comparison/DefaultRecursiveComparisonIntrospectionStrategy.java | DefaultRecursiveComparisonIntrospectionStrategy | getChildrenNodeNamesOf | class DefaultRecursiveComparisonIntrospectionStrategy implements RecursiveComparisonIntrospectionStrategy {
// use ConcurrentHashMap in case this strategy instance is used in a multi-thread context
private final Map<Class<?>, Set<String>> fieldNamesPerClass = new ConcurrentHashMap<>();
@Override
public Set<St... |
if (node == null) return new HashSet<>();
// Caches the names after getting them for efficiency, a node can be introspected multiple times for example if
// it belongs to an unordered collection as all actual elements are compared to all expected elements.
return fieldNamesPerClass.computeIfAbsent(node... | 150 | 88 | 238 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/recursive/comparison/FieldComparators.java | FieldComparators | getComparatorForField | class FieldComparators extends FieldHolder<Comparator<?>> {
protected final LinkedList<ComparatorForPatterns> comparatorByPatterns = new LinkedList<>();
/**
* Registers the {@code comparator} for the given {@code fieldLocation}.
*
* @param fieldLocation the location where to apply the comparator
* @pa... |
Comparator<?> exactFieldLocationComparator = super.get(fieldLocation);
if (exactFieldLocationComparator != null) return exactFieldLocationComparator;
// no comparator for exact location, check if there is a regex that matches the field location
return comparatorByPatterns.stream()
... | 837 | 139 | 976 | <methods>public void <init>() ,public Stream<Entry<java.lang.String,Comparator<?>>> entryByField() ,public boolean equals(java.lang.Object) ,public Comparator<?> get(java.lang.String) ,public boolean hasEntity(java.lang.String) ,public int hashCode() ,public boolean isEmpty() ,public void put(java.lang.String, Comparat... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/recursive/comparison/FieldHolder.java | FieldHolder | toString | class FieldHolder<T> {
protected final Map<String, T> fieldHolder;
public FieldHolder() {
fieldHolder = new TreeMap<>();
}
/**
* Pairs the giving {@code entity} with the {@code fieldLocation}.
*
* @param fieldLocation the field location where to apply the giving entity
* @param entity the ent... |
List<String> registeredEntitiesDescription = fieldHolder.entrySet().stream()
.map(FieldHolder::formatRegisteredEntity)
.collect(toList());
return format("{%s}", join(registeredEntitiesDescrip... | 604 | 67 | 671 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/api/recursive/comparison/VisitedDualValues.java | VisitedDualValues | registeredComparisonDifferencesOf | class VisitedDualValues {
private List<VisitedDualValue> dualValues;
VisitedDualValues() {
this.dualValues = new ArrayList<>();
}
void registerVisitedDualValue(DualValue dualValue) {
this.dualValues.add(new VisitedDualValue(dualValue));
}
void registerComparisonDifference(DualValue dualValue, Co... |
return this.dualValues.stream()
// use sameValues to get already visited dual values with different location
.filter(visitedDualValue -> visitedDualValue.dualValue.sameValues(dualValue))
.findFirst()
.map(visite... | 374 | 82 | 456 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/condition/Join.java | Join | checkNotNullConditions | class Join<T> extends Condition<T> {
protected static final String SUFFIX_DELIMITER = "]";
protected static final String PREFIX_DELIMITER = ":[";
@VisibleForTesting
Collection<Condition<? super T>> conditions;
/**
* Creates a new <code>{@link Join}</code>.
* @param conditions the conditions to join.
... |
return requireNonNull(conditions, "The given conditions should not be null");
| 765 | 21 | 786 | <methods>public void <init>() ,public void <init>(java.lang.String) ,public transient void <init>(Predicate<T>, java.lang.String, java.lang.Object[]) ,public void <init>(org.assertj.core.description.Description) ,public org.assertj.core.description.Description conditionDescriptionWithStatus(T) ,public Condition<T> desc... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/condition/MappedCondition.java | MappedCondition | buildMappingDescription | class MappedCondition<FROM, TO> extends Condition<FROM> {
private Condition<TO> condition;
private Function<FROM, TO> mapping;
private String mappingDescription;
/**
* Creates a new <code>{@link MappedCondition}</code>.
* <p>
* Example:
* <pre><code class='java'> Condition<String> hasLineSep... |
StringBuilder sb = new StringBuilder("mapped");
if (!mappingDescription.isEmpty()) sb.append(format("%n using: %s", mappingDescription));
if (from == null) sb.append(format("%n from: %s%n", from));
else sb.append(format("%n from: <%s> %s%n", className(from), from));
if (to == null) sb.appe... | 1,285 | 192 | 1,477 | <methods>public void <init>() ,public void <init>(java.lang.String) ,public transient void <init>(Predicate<FROM>, java.lang.String, java.lang.Object[]) ,public void <init>(org.assertj.core.description.Description) ,public org.assertj.core.description.Description conditionDescriptionWithStatus(FROM) ,public Condition<F... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/condition/NestableCondition.java | NestableCondition | compose | class NestableCondition<ACTUAL, NESTED> extends Join<ACTUAL> {
private final String descriptionPrefix;
/**
* Creates a new <code>{@link NestableCondition}</code>
* @param descriptionPrefix the prefix to use to build the description
* @param extractor a function to extract the nested object of type {@liter... |
return new Condition<ACTUAL>(condition.description()) {
@Override
public boolean matches(ACTUAL value) {
return condition.matches(extractor.apply(value));
}
@Override
public Description conditionDescriptionWithStatus(ACTUAL actual) {
return condition.conditionDescript... | 745 | 96 | 841 | <methods>public org.assertj.core.description.Description conditionDescriptionWithStatus(ACTUAL) ,public final Collection<Condition<? super ACTUAL>> conditions() ,public org.assertj.core.description.Description description() ,public abstract java.lang.String descriptionPrefix() <variables>protected static final java.lan... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/condition/VerboseCondition.java | VerboseCondition | buildVerboseDescription | class VerboseCondition<T> extends Condition<T> {
private Function<T, String> objectUnderTestDescriptor;
// needed to avoid an incorrect description when matches is run multiple times.
private String description;
/**
* Creates a new <code>{@link VerboseCondition}</code> to have better control over the cond... |
StringBuilder sb = new StringBuilder(format("%s", description));
if (!matches) sb.append(objectUnderTestDescriptor.apply(objectUnderTest));
return sb.toString();
| 1,065 | 48 | 1,113 | <methods>public void <init>() ,public void <init>(java.lang.String) ,public transient void <init>(Predicate<T>, java.lang.String, java.lang.Object[]) ,public void <init>(org.assertj.core.description.Description) ,public org.assertj.core.description.Description conditionDescriptionWithStatus(T) ,public Condition<T> desc... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/configuration/ConfigurationProvider.java | ConfigurationProvider | loadRegisteredConfiguration | class ConfigurationProvider {
public static final ConfigurationProvider CONFIGURATION_PROVIDER = new ConfigurationProvider();
private final Configuration configuration;
private CompositeRepresentation compositeRepresentation;
private ConfigurationProvider() {
configuration = Services.get(Configuration.cla... |
// does nothing but results in loading any registered Configuration as CONFIGURATION_PROVIDER is initialized
| 800 | 26 | 826 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/configuration/Services.java | Services | get | class Services {
private Services() {}
public static <SERVICE> SERVICE get(Class<SERVICE> serviceType, SERVICE defaultValue) {<FILL_FUNCTION_BODY>}
public static <SERVICE> List<SERVICE> getAll(Class<SERVICE> serviceType) {
Iterator<SERVICE> services = ServiceLoader.load(serviceType, Services.class.getClass... |
Iterator<SERVICE> services = ServiceLoader.load(serviceType, Services.class.getClassLoader()).iterator();
SERVICE result = services.hasNext() ? services.next() : defaultValue;
if (services.hasNext()) {
result = defaultValue;
System.err.println(format("Found multiple implementations for the se... | 117 | 116 | 233 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/data/Index.java | Index | equals | class Index {
public final int value;
/**
* Creates a new {@link Index}.
*
* @param value the value of the index.
* @return the created {@code Index}.
* @throws IllegalArgumentException if the given value is negative.
*/
public static Index atIndex(int value) {
checkArgument(value >= 0, "T... |
if (this == obj) return true;
if (!(obj instanceof Index)) return false;
Index other = (Index) obj;
return value == other.value;
| 230 | 45 | 275 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/data/MapEntry.java | MapEntry | equals | class MapEntry<K, V> implements Map.Entry<K, V> {
public final K key;
public final V value;
/**
* Creates a new {@link MapEntry}.
*
* @param <K> the type of the key of this entry.
* @param <V> the type of the value of this entry.
* @param key the key of the entry to create.
* @param value the ... |
if (this == object) return true;
if (!(object instanceof Map.Entry)) return false;
Map.Entry<?, ?> that = (Map.Entry<?, ?>) object;
return Objects.equals(key, that.getKey()) && Objects.equals(value, that.getValue());
| 440 | 77 | 517 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/data/Offset.java | Offset | offset | class Offset<T extends Number> {
public final T value;
/**
* When |actual-expected|=offset and strict is true the assertThat(actual).isCloseTo(expected, offset); assertion will fail.
*/
public final boolean strict;
/**
* Creates a new {@link Offset} that let {@code isCloseTo} assertions pass when {@c... |
requireNonNull(value);
checkArgument(value.doubleValue() >= 0d, "An offset value should be greater than or equal to zero");
return new Offset<>(value, false);
| 817 | 50 | 867 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/data/Percentage.java | Percentage | equals | class Percentage {
public final double value;
/**
* Creates a new {@link org.assertj.core.data.Percentage}.
*
* @param value the value of the percentage.
* @return the created {@code Percentage}.
* @throws NullPointerException if the given value is {@code null}.
* @throws IllegalArgumentExceptio... |
if (this == obj) return true;
if (!(obj instanceof Percentage)) return false;
Percentage other = (Percentage) obj;
return Double.compare(value, other.value) == 0;
| 309 | 58 | 367 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/data/TemporalUnitOffset.java | TemporalUnitOffset | equals | class TemporalUnitOffset implements TemporalOffset<Temporal> {
protected final TemporalUnit unit;
protected final long value;
/**
* Creates a new temporal offset for a given temporal unit.
* @param value the value of the offset.
* @param unit temporal unit of the offset.
* @throws NullPointerExcepti... |
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
TemporalUnitOffset other = (TemporalUnitOffset) obj;
return value == other.value;
| 647 | 69 | 716 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/data/TemporalUnitWithinOffset.java | TemporalUnitWithinOffset | isBeyondOffset | class TemporalUnitWithinOffset extends TemporalUnitOffset {
public TemporalUnitWithinOffset(long value, TemporalUnit unit) {
super(value, unit);
}
/**
* Checks if difference between temporal values is less then or equal to offset.
* @param temporal1 first temporal value to be validated against second ... |
try {
return getDifference(temporal1, temporal2) > value;
} catch (@SuppressWarnings("unused") ArithmeticException e) {
return getAbsoluteDuration(temporal1, temporal2).compareTo(Duration.of(value, unit)) > 0;
}
| 235 | 78 | 313 | <methods>public void <init>(long, java.time.temporal.TemporalUnit) ,public boolean equals(java.lang.Object) ,public java.lang.String getBeyondOffsetDifferenceDescription(java.time.temporal.Temporal, java.time.temporal.Temporal) ,public java.time.temporal.TemporalUnit getUnit() ,public int hashCode() <variables>protecte... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/description/Description.java | Description | mostRelevantDescription | class Description {
/**
* @return the value of this description.
*/
public abstract String value();
@Override
public String toString() {
return value();
}
public static Description emptyIfNull(Description description) {
return description == null ? emptyDescription() : description;
}
pu... |
boolean isDescriptionSet = existingDescription != null && !isNullOrEmpty(existingDescription.value());
return isDescriptionSet ? existingDescription.value() : newDescription;
| 116 | 44 | 160 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/description/JoinDescription.java | JoinDescription | appendIndentedValueTo | class JoinDescription extends Description {
private static final int DEFAULT_INDENTATION = 3;
private static final String LINE_SEPARATOR = System.lineSeparator();
/**
* Delimiter string between {@code descriptions}.
*/
private static final String DELIMITER = ',' + LINE_SEPARATOR;
@VisibleForTesting
f... |
// indent and begin adding the current description starting with prefix
indentableBuilder.indent().append(prefix);
// special case where there is no descriptions
if (descriptions.isEmpty()) return indentableBuilder.append(suffix); // no line sep
// descriptions section
indentableBuilder.appen... | 1,130 | 314 | 1,444 | <methods>public non-sealed void <init>() ,public static org.assertj.core.description.Description emptyIfNull(org.assertj.core.description.Description) ,public static java.lang.String mostRelevantDescription(org.assertj.core.description.Description, java.lang.String) ,public java.lang.String toString() ,public abstract ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/description/LazyTextDescription.java | LazyTextDescription | value | class LazyTextDescription extends Description {
private Supplier<String> descriptionSupplier;
public LazyTextDescription(Supplier<String> descriptionSupplier) {
this.descriptionSupplier = descriptionSupplier;
}
@Override
public String value() {<FILL_FUNCTION_BODY>}
} |
checkState(descriptionSupplier != null, "the descriptionSupplier should not be null");
return descriptionSupplier.get();
| 82 | 34 | 116 | <methods>public non-sealed void <init>() ,public static org.assertj.core.description.Description emptyIfNull(org.assertj.core.description.Description) ,public static java.lang.String mostRelevantDescription(org.assertj.core.description.Description, java.lang.String) ,public java.lang.String toString() ,public abstract ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/description/TextDescription.java | TextDescription | equals | class TextDescription extends Description {
@VisibleForTesting
final String value;
final Object[] args;
/**
* Creates a new <code>{@link TextDescription}</code>.
*
* @param value the value of this description.
* @param args the replacements parameters of this description.
* @throws NullPointerE... |
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
TextDescription other = (TextDescription) obj;
return deepEquals(value, other.value) && deepEquals(args, other.args);
| 240 | 76 | 316 | <methods>public non-sealed void <init>() ,public static org.assertj.core.description.Description emptyIfNull(org.assertj.core.description.Description) ,public static java.lang.String mostRelevantDescription(org.assertj.core.description.Description, java.lang.String) ,public java.lang.String toString() ,public abstract ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/AbstractShouldHaveTextContent.java | AbstractShouldHaveTextContent | create | class AbstractShouldHaveTextContent extends BasicErrorMessageFactory {
protected String diffs;
public AbstractShouldHaveTextContent(String format, Object... arguments) {
super(format, arguments);
}
@Override
public String create(Description d, Representation representation) {<FILL_FUNCTION_BODY>}
pr... |
// we append diffs here as we can't add in super constructor call, see why below.
//
// case 1 - append diffs to String passed in super :
// super("file:<%s> and file:<%s> do not have equal content:" + diffs, actual, expected);
// this leads to a MissingFormatArgumentException if diffs contains a f... | 135 | 260 | 395 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/AssertJMultipleFailuresError.java | AssertJMultipleFailuresError | getMessage | class AssertJMultipleFailuresError extends MultipleFailuresError {
private static final long serialVersionUID = 1L;
private static final String EOL = System.getProperty("line.separator");
private static final String ERROR_SEPARATOR = EOL + "-- failure %d --";
private String heading;
public AssertJMultipleFai... |
List<Throwable> failures = getFailures();
int failureCount = failures.size();
if (failureCount == 0) return super.getMessage();
heading = isBlank(heading) ? "Multiple Failures" : heading.trim();
StringBuilder builder = new StringBuilder(EOL).append(heading)
... | 323 | 262 | 585 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/AssertionErrorCreator.java | AssertionErrorCreator | assertionFailedError | class AssertionErrorCreator {
private static final Class<?>[] MSG_ARG_TYPES_FOR_ASSERTION_FAILED_ERROR = array(String.class, Object.class, Object.class);
private static final Class<?>[] MSG_ARG_TYPES_FOR_COMPARISON_FAILURE = array(String.class, String.class, String.class);
private static final Class<?>[] MULTI... |
try {
Object o = constructorInvoker.newInstance("org.opentest4j.AssertionFailedError",
MSG_ARG_TYPES_FOR_ASSERTION_FAILED_ERROR,
message,
expected,
... | 1,355 | 117 | 1,472 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/AssertionErrorMessagesAggregator.java | AssertionErrorMessagesAggregator | aggregateErrorMessages | class AssertionErrorMessagesAggregator {
public static String aggregateErrorMessages(List<String> errors) {<FILL_FUNCTION_BODY>}
private static void countAssertions(List<String> errors, StringBuilder msg) {
int size = errors.size();
if (size == 1) {
msg.append("assertion");
} else {
msg.ap... |
StringBuilder msg = new StringBuilder("%nThe following ");
countAssertions(errors, msg);
msg.append(" failed:%n");
for (int i = 0; i < errors.size(); i++) {
msg.append(i + 1).append(") ").append(errors.get(i)).append("%n");
}
return MessageFormatter.instance().format(null, null, msg.toSt... | 113 | 107 | 220 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/BasicErrorMessageFactory.java | UnquotedString | equals | class UnquotedString implements CharSequence {
private final String string;
private UnquotedString(String string) {
this.string = requireNonNull(string, "string is mandatory");
}
@Override
public int length() {
return string.length();
}
@Override
public char charAt(int in... |
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BasicErrorMessageFactory other = (BasicErrorMessageFactory) obj;
if (!deepEquals(format, other.format))
return false;
// because it does not manage array recursiv... | 664 | 155 | 819 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ClassModifierShouldBe.java | ClassModifierShouldBe | modifiers | class ClassModifierShouldBe extends BasicErrorMessageFactory {
private static final String PACKAGE_PRIVATE = "package-private";
private ClassModifierShouldBe(Class<?> actual, boolean positive, String modifier) {
super("%nExpecting actual:%n %s%n" + (positive ? "to" : "not to") + " be a %s class but was %s.",... |
int modifiers = actual.getModifiers();
boolean isPackagePrivate = !isPublic(modifiers) && !isProtected(modifiers) && !isPrivate(modifiers);
String modifiersDescription = Modifier.toString(modifiers);
StringJoiner sj = new StringJoiner(" ");
if (isPackagePrivate) {
sj.add(PACKAGE_PRIVATE);
... | 987 | 138 | 1,125 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ConstructorInvoker.java | ConstructorInvoker | newInstance | class ConstructorInvoker {
public Object newInstance(String className, Class<?>[] parameterTypes, Object... parameterValues) throws Exception {<FILL_FUNCTION_BODY>}
} |
Class<?> targetType = Class.forName(className);
Constructor<?> constructor = targetType.getConstructor(parameterTypes);
return constructor.newInstance(parameterValues);
| 48 | 48 | 96 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/DescriptionFormatter.java | DescriptionFormatter | format | class DescriptionFormatter {
private static final DescriptionFormatter INSTANCE = new DescriptionFormatter();
/**
* Returns the singleton instance of this class.
* @return the singleton instance of this class.
*/
public static DescriptionFormatter instance() {
return INSTANCE;
}
@VisibleForTes... |
String s = (d != null) ? d.value() : null;
if (isNullOrEmpty(s)) return "";
return String.format("[%s] ", s);
| 207 | 49 | 256 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ElementsShouldMatch.java | ElementsShouldMatch | elementsShouldMatch | class ElementsShouldMatch extends BasicErrorMessageFactory {
private static final String SINGLE_NON_MATCHING_ELEMENT = "%nExpecting all elements of:%n %s%nto match %s predicate but this element did not:%n %s";
private static final String MULTIPLE_NON_MATCHING_ELEMENT = "%nExpecting all elements of:%n %s%nto mat... |
return elementsNotMatchingPredicate instanceof Iterable
? new ElementsShouldMatch(actual, (Iterable<?>) elementsNotMatchingPredicate, predicateDescription)
: new ElementsShouldMatch(actual, elementsNotMatchingPredicate, predicateDescription);
| 284 | 64 | 348 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ElementsShouldSatisfy.java | ElementsShouldSatisfy | elementsShouldSatisfy | class ElementsShouldSatisfy extends BasicErrorMessageFactory {
public static ErrorMessageFactory elementsShouldSatisfyAny(Object actual,
List<UnsatisfiedRequirement> elementsNotSatisfyingRequirements,
... |
return new ElementsShouldSatisfy("%n" +
"Expecting all elements of:%n" +
" %s%n" +
"to satisfy given requirements, but these elements did not:%n%n",
actual, elementsN... | 754 | 75 | 829 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/GroupTypeDescription.java | GroupTypeDescription | getGroupTypeDescription | class GroupTypeDescription {
private static final int SPLITERATORS_CLASS_STACK_TRACE_NUM = 5;
private String groupTypeName;
private String elementTypeName;
public GroupTypeDescription(String groupTypeName, String elementTypeName) {
this.groupTypeName = groupTypeName;
this.elementTypeName = elementTypeN... |
if (Thread.currentThread().getStackTrace()[SPLITERATORS_CLASS_STACK_TRACE_NUM].getClassName().contains("Spliterators"))
return new GroupTypeDescription("spliterator characteristics", "characteristics");
if (Map.class.isAssignableFrom(clazz)) return new GroupTypeDescription("map", "map entries");
i... | 323 | 161 | 484 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/MessageFormatter.java | MessageFormatter | format | class MessageFormatter {
private static final MessageFormatter INSTANCE = new MessageFormatter();
public static MessageFormatter instance() {
return INSTANCE;
}
@VisibleForTesting
DescriptionFormatter descriptionFormatter = DescriptionFormatter.instance();
@VisibleForTesting
MessageFormatter() {}
... |
int argCount = args.length;
String[] formatted = new String[argCount];
for (int i = 0; i < argCount; i++) {
formatted[i] = asText(p, args[i]);
}
return formatted;
| 493 | 67 | 560 | <no_super_class> |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/OptionalDoubleShouldHaveValueCloseToPercentage.java | OptionalDoubleShouldHaveValueCloseToPercentage | shouldHaveValueCloseToPercentage | class OptionalDoubleShouldHaveValueCloseToPercentage extends BasicErrorMessageFactory {
private OptionalDoubleShouldHaveValueCloseToPercentage(double expected) {
super("%nExpecting an OptionalDouble with value:%n" +
" %s%n" +
"but was empty.",
expected);
}
private OptionalDoub... |
double actualPercentage = difference / expectedValue * 100d;
return new OptionalDoubleShouldHaveValueCloseToPercentage(optional, expectedValue, percentage, actualPercentage);
| 521 | 49 | 570 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/OptionalShouldContain.java | OptionalShouldContain | shouldContainSame | class OptionalShouldContain extends BasicErrorMessageFactory {
private static final String EXPECTING_TO_CONTAIN = "%nExpecting actual:%n %s%nto contain:%n %s%nbut did not.";
private static final String EXPECTING_TO_CONTAIN_SAME = "%nExpecting actual:%n %s%nto contain the instance (i.e. compared with ==):%n %s%... |
return optional.isPresent()
? new OptionalShouldContain(EXPECTING_TO_CONTAIN_SAME, optional, expectedValue)
: shouldContain(expectedValue);
| 1,103 | 48 | 1,151 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/OptionalShouldContainInstanceOf.java | OptionalShouldContainInstanceOf | shouldContainInstanceOf | class OptionalShouldContainInstanceOf extends BasicErrorMessageFactory {
private OptionalShouldContainInstanceOf(String message) {
super(message);
}
/**
* Indicates that a value should be present in an empty {@link java.util.Optional}.
*
* @param value Optional to be checked.
* @param clazz the ... |
Optional<?> optional = (Optional<?>) value;
if (optional.isPresent()) {
return new OptionalShouldContainInstanceOf(format("%nExpecting actual:%n %s%nto contain a value that is an instance of:%n %s%nbut did contain an instance of:%n %s",
optional.get... | 165 | 176 | 341 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldAccept.java | ShouldAccept | shouldAccept | class ShouldAccept extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldAccept}</code>.
*
* @param <T> guarantees that the type of the value value and the generic type of the {@code Predicate} are the same.
* @param predicate the {@code Predicate}.
* @param value the value value i... |
requireNonNull(description, "The predicate description must not be null");
return new ShouldAccept(value, description);
| 224 | 31 | 255 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldBe.java | ShouldBe | shouldBe | class ShouldBe extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldBe}</code>.
* @param <T> guarantees that the type of the actual value and the generic type of the {@code Condition} are the same.
* @param actual the actual value in the failed assertion.
* @param condition the {@cod... |
if (condition instanceof Join) return new ShouldBe(actual, (Join<? super T>) condition);
return new ShouldBe(actual, condition);
| 285 | 39 | 324 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldBeAfter.java | ShouldBeAfter | shouldBeAfter | class ShouldBeAfter extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldBeAfter}</code>.
* @param actual the actual value in the failed assertion.
* @param other the value used in the failed assertion to compare the actual value to.
* @param comparisonStrategy the {@link ComparisonS... |
Date januaryTheFirstOfGivenYear = parse(year + "-01-01");
return new ShouldBeAfter(actual, januaryTheFirstOfGivenYear, StandardComparisonStrategy.instance());
| 432 | 51 | 483 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldBeEmpty.java | ShouldBeEmpty | shouldBeEmpty | class ShouldBeEmpty extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldBeEmpty}</code>.
* @param actual the actual value in the failed assertion.
* @return the created {@code ErrorMessageFactory}.
*/
public static ErrorMessageFactory shouldBeEmpty(Object actual) {
return new ... |
return new ShouldBeEmpty("%nExpecting file %s to be empty", actual);
| 313 | 24 | 337 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldBeEqualByComparingFieldByFieldRecursively.java | ShouldBeEqualByComparingFieldByFieldRecursively | describeDifference | class ShouldBeEqualByComparingFieldByFieldRecursively extends BasicErrorMessageFactory {
public static ErrorMessageFactory shouldBeEqualByComparingFieldByFieldRecursive(Object actual, Object other,
List<Difference> differences,
... |
UnambiguousRepresentation unambiguousRepresentation = new UnambiguousRepresentation(representation, difference.getActual(),
difference.getOther());
String additionalInfo = difference.getDescription()
... | 645 | 178 | 823 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldBeEqualByComparingOnlyGivenFields.java | ShouldBeEqualByComparingOnlyGivenFields | shouldBeEqualComparingOnlyGivenFields | class ShouldBeEqualByComparingOnlyGivenFields extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldBeEqualByComparingOnlyGivenFields}</code>.
*
*
* @param actual the actual value in the failed assertion.
* @param rejectedFields fields names not matching
* @param rejectedValues ... |
if (rejectedFields.size() == 1) {
return new ShouldBeEqualByComparingOnlyGivenFields(actual, rejectedFields.get(0), rejectedValues.get(0),
expectedValues.get(0),
acceptedFields);
}
return... | 445 | 97 | 542 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldBeEqualToIgnoringFields.java | ShouldBeEqualToIgnoringFields | shouldBeEqualToIgnoringGivenFields | class ShouldBeEqualToIgnoringFields extends BasicErrorMessageFactory {
private static final String EXPECTED_MULTIPLE = "%nExpecting values:%n %s%nin fields:%n %s%nbut were:%n %s%nin %s.%n";
private static final String EXPECTED_SINGLE = "%nExpecting value %s in field %s but was %s in %s.%n";
private static fin... |
if (rejectedFields.size() == 1) {
if (ignoredFields.isEmpty()) {
return new ShouldBeEqualToIgnoringFields(actual, rejectedFields.get(0), rejectedValues.get(0),
expectedValues.get(0));
}
return new ShouldBeEqualToIgnoringFields(actual, rejec... | 620 | 176 | 796 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldBeEqualWithTimePrecision.java | ShouldBeEqualWithTimePrecision | buildErrorMessageTemplate | class ShouldBeEqualWithTimePrecision extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link org.assertj.core.error.ShouldBeEqualWithTimePrecision}</code>.
*
* @param actual the actual value in the failed assertion.
* @param expected the expected value in the failed assertion.
* @param... |
String fields = "";
String lastField = "";
if (precision.equals(TimeUnit.HOURS)) {
lastField = "day";
} else if (precision.equals(TimeUnit.MINUTES)) {
fields = ", day";
lastField = "hour";
} else if (precision.equals(TimeUnit.SECONDS)) {
fields = ", day, hour";
lastFie... | 240 | 223 | 463 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldBeEqualWithinPercentage.java | ShouldBeEqualWithinPercentage | shouldBeEqualWithinPercentage | class ShouldBeEqualWithinPercentage extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link org.assertj.core.error.ShouldBeEqualWithinPercentage}</code>.
*
* @param <T> the type of values to compare.
* @param actual the actual value in the failed assertion.
* @param expected the expected v... |
double expectedPercentage = difference.doubleValue() / expected.doubleValue() * 100d;
return new ShouldBeEqualWithinPercentage(actual, expected, percentage, expectedPercentage);
| 329 | 53 | 382 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldBeExactlyInstanceOf.java | ShouldBeExactlyInstanceOf | shouldBeExactlyInstance | class ShouldBeExactlyInstanceOf extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldBeExactlyInstanceOf}</code>.
*
* @param actual the actual value in the failed assertion.
* @param type the type {@code actual} is expected to be.
* @return the created {@code ErrorMessageFactory}.... |
return actual instanceof Throwable
? new ShouldBeExactlyInstanceOf((Throwable) actual, type)
: new ShouldBeExactlyInstanceOf(actual, type);
| 278 | 46 | 324 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldBeInstance.java | ShouldBeInstance | shouldBeInstance | class ShouldBeInstance extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldBeInstance}</code>.
*
* @param object the object value in the failed assertion.
* @param type the type {@code object} is \nExpecting:\n to belong to.
* @return the created {@code ErrorMessageFactory}.
*... |
return object instanceof Throwable ? new ShouldBeInstance((Throwable) object, type) : new ShouldBeInstance(object, type);
| 534 | 34 | 568 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldBeInstanceOfAny.java | ShouldBeInstanceOfAny | shouldBeInstanceOfAny | class ShouldBeInstanceOfAny extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldBeInstanceOfAny}</code>.
*
* @param actual the actual value in the failed assertion.
* @param types contains the type or types {@code actual} is expected to belong to.
* @return the created {@code Err... |
return actual instanceof Throwable ? new ShouldBeInstanceOfAny((Throwable) actual, types)
: new ShouldBeInstanceOfAny(actual, types);
| 282 | 40 | 322 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldBeSorted.java | ShouldBeSorted | shouldBeSorted | class ShouldBeSorted extends BasicErrorMessageFactory {
private ShouldBeSorted(String format, Object... arguments) {
super(format, arguments);
}
/**
* Creates a new <code>{@link ShouldBeSorted}</code>.
*
* @param i the index of elements whose not naturally ordered with the next.
* @param group ... |
List<?> groupAsList = groupAsList(group);
return new ShouldBeSorted(
"%ngroup is not sorted because element %s:%n %s%nis not less or equal than element %s:%n %s%ngroup was:%n %s",
i, groupAsList.get(i), i + 1, groupAsList.get(i + 1), groupAsList);
... | 608 | 103 | 711 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldContain.java | ShouldContain | shouldContain | class ShouldContain extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldContain}</code>.
* @param actual the actual value in the failed assertion.
* @param expected values expected to be in {@code actual}.
* @param notFound the values in {@code expected} not found in {@code actual}.... |
GroupTypeDescription groupTypeDescription = getGroupTypeDescription(clazz);
return new ShouldContain(actual, expected, notFound, comparisonStrategy, groupTypeDescription);
| 938 | 42 | 980 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldContainCharSequenceOnlyOnce.java | ShouldContainCharSequenceOnlyOnce | shouldContainOnlyOnce | class ShouldContainCharSequenceOnlyOnce extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldContainCharSequenceOnlyOnce}</code>.
*
* @param actual the actual value in the failed assertion.
* @param sequence the String expected to be in {@code actual} only once.
* @param occurren... |
if (occurrences == 0) return new ShouldContainCharSequenceOnlyOnce(actual, sequence, comparisonStrategy);
return new ShouldContainCharSequenceOnlyOnce(actual, sequence, occurrences, comparisonStrategy);
| 509 | 54 | 563 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldContainEntries.java | ShouldContainEntries | shouldContainEntries | class ShouldContainEntries extends BasicErrorMessageFactory {
public static <K, V> ErrorMessageFactory shouldContainEntries(Map<? extends K, ? extends V> actual,
Entry<? extends K, ? extends V>[] expectedEntries,
... |
if (entriesWithWrongValue.isEmpty()) return new ShouldContainEntries(actual, expectedEntries, entriesWithKeyNotFound);
if (entriesWithKeyNotFound.isEmpty())
return new ShouldContainEntries(actual, expectedEntries,
buildValueDifferences(actual, entriesWithWrongValue, ... | 845 | 130 | 975 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldContainExactlyInAnyOrder.java | ShouldContainExactlyInAnyOrder | shouldContainExactlyInAnyOrder | class ShouldContainExactlyInAnyOrder extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldContainExactlyInAnyOrder}</code>.
*
* @param actual the actual value in the failed assertion.
* @param expected values expected to be contained in {@code actual}.
* @param notFound values in ... |
if (isNullOrEmpty(notExpected)) {
return new ShouldContainExactlyInAnyOrder(actual, expected, notFound, NOT_FOUND_ONLY, comparisonStrategy);
}
if (isNullOrEmpty(notFound)) {
return new ShouldContainExactlyInAnyOrder(actual, expected, notExpected, NOT_EXPECTED_ONLY, comparisonStrategy);
}
... | 593 | 129 | 722 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldContainKeys.java | ShouldContainKeys | shouldContainKeys | class ShouldContainKeys extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldContainKeys}</code>.
*
* @param <K> key type
* @param actual the actual value in the failed assertion.
* @param keys the expected keys
* @return the created {@code ErrorMessageFactory}.
*/
public... |
if (keys.size() == 1) return new ShouldContainKeys(actual, keys.iterator().next());
return new ShouldContainKeys(actual, keys);
| 240 | 42 | 282 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldContainOnly.java | ShouldContainOnly | shouldContainOnly | class ShouldContainOnly extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldContainOnly}</code>.
*
* @param actual the actual value in the failed assertion.
* @param expected values expected to be contained in {@code actual}.
* @param notFound values in {@code expected} not found... |
GroupTypeDescription groupTypeDescription = getGroupTypeDescription(actual);
return shouldContainOnly(actual, expected, notFound, notExpected, comparisonStrategy, groupTypeDescription);
| 1,069 | 44 | 1,113 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldContainOnlyKeys.java | ShouldContainOnlyKeys | shouldContainOnlyKeys | class ShouldContainOnlyKeys extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldContainOnlyKeys}</code>.
*
* @param actual the actual value in the failed assertion.
* @param expected values expected to be contained in {@code actual}.
* @param notFound values in {@code expected} ... |
if (isNullOrEmpty(notExpected)) {
return new ShouldContainOnlyKeys(actual, expected, notFound, StandardComparisonStrategy.instance());
}
return new ShouldContainOnlyKeys(actual, expected, notFound, notExpected, StandardComparisonStrategy.instance());
| 628 | 68 | 696 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldContainOnlyNulls.java | ShouldContainOnlyNulls | describe | class ShouldContainOnlyNulls extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldContainOnlyNulls}</code>.
* @param actual the actual value in the failed assertion.
* @return the created {@code ErrorMessageFactory}.
*/
public static ErrorMessageFactory shouldContainOnlyNulls(Objec... |
switch (errorType) {
case EMPTY:
return "it was empty";
case NON_NULL_ELEMENTS:
default:
return "some elements were not:%n %s";
}
| 306 | 60 | 366 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldContainSubsequence.java | ShouldContainSubsequence | describeComparisonStrategy | class ShouldContainSubsequence extends BasicErrorMessageFactory {
public static ShouldContainSubsequence actualDoesNotHaveEnoughElementsToContainSubsequence(Object actual, Object subsequence) {
return new ShouldContainSubsequence(actual, subsequence);
}
private ShouldContainSubsequence(Object actual, Object... |
return comparisonStrategy == StandardComparisonStrategy.instance() ? ""
: " when comparing elements using " + comparisonStrategy;
| 825 | 30 | 855 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldContainSubsequenceOfCharSequence.java | ShouldContainSubsequenceOfCharSequence | shouldContainSubsequence | class ShouldContainSubsequenceOfCharSequence extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldContainSubsequenceOfCharSequence}</code>.
*
* @param actual the actual value in the failed assertion.
* @param strings the sequence of values expected to be in {@code actual}.
* @para... |
String detailedErrorMessage;
if (notFoundRepeatedSubsequence.size() == 1) {
Map.Entry<CharSequence, Integer> singleEntry = notFoundRepeatedSubsequence.entrySet().iterator().next();
detailedErrorMessage = format("But the %s occurrence of \"%s\" was not found", ordinal(singleEntry.getValue() + 1),
... | 1,085 | 296 | 1,381 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldContainValues.java | ShouldContainValues | shouldContainValues | class ShouldContainValues extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldContainValues}</code>.
*
* @param <V> value type
* @param actual the actual value in the failed assertion.
* @param values the expected values.
* @return the created {@code ErrorMessageFactory}.
*... |
if (values.size() == 1) return shouldContainValue(actual, values.iterator().next());
return new ShouldContainValues(actual, values);
| 187 | 41 | 228 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldContainsOnlyOnce.java | ShouldContainsOnlyOnce | shouldContainsOnlyOnce | class ShouldContainsOnlyOnce extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldContainsOnlyOnce}</code>.
*
* @param actual the actual value in the failed assertion.
* @param expected values expected to be contained in {@code actual}.
* @param notFound values in {@code expected... |
if (!isNullOrEmpty(notFound) && !isNullOrEmpty(notOnlyOnce))
return new ShouldContainsOnlyOnce(actual, expected, notFound, notOnlyOnce, comparisonStrategy);
if (!isNullOrEmpty(notFound))
return new ShouldContainsOnlyOnce(actual, expected, notFound, comparisonStrategy);
// case where no elements... | 726 | 116 | 842 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldHave.java | ShouldHave | shouldHave | class ShouldHave extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link ShouldHave}</code>.
* @param <T> guarantees that the type of the actual value and the generic type of the {@code Condition} are the same.
* @param actual the actual value in the failed assertion.
* @param condition the {... |
if (condition instanceof Join) return new ShouldHave(actual, (Join<? super T>) condition);
return new ShouldHave(actual, condition);
| 284 | 39 | 323 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldHaveAllNullFields.java | ShouldHaveAllNullFields | shouldHaveAllNullFields | class ShouldHaveAllNullFields extends BasicErrorMessageFactory {
private static final String EXPECTED_MULTIPLE = "%nExpecting%n %s%nto only have null properties or fields but these were not null:%n %s.%n";
private static final String EXPECTED_SINGLE = "%nExpecting%n %s%nto only have null property or field, but ... |
if (nonNullFields.size() == 1) {
if (ignoredFields.isEmpty()) {
return new ShouldHaveAllNullFields(actual, nonNullFields.get(0));
}
return new ShouldHaveAllNullFields(actual, nonNullFields.get(0), ignoredFields);
}
return ignoredFields.isEmpty()
? new ShouldHaveAllNullFiel... | 427 | 120 | 547 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldHaveCause.java | ShouldHaveCause | shouldHaveCause | class ShouldHaveCause extends BasicErrorMessageFactory {
public static ErrorMessageFactory shouldHaveCause(Throwable actual, Throwable expectedCause) {<FILL_FUNCTION_BODY>}
public static ErrorMessageFactory shouldHaveCause(Throwable actualCause) {
return new BasicErrorMessageFactory("Expecting actual throwabl... |
checkArgument(expectedCause != null, "expected cause should not be null");
// actual has no cause
if (actual.getCause() == null) return new ShouldHaveCause(expectedCause);
// same message => different type
if (Objects.equals(actual.getCause().getMessage(), expectedCause.getMessage()))
return ... | 648 | 166 | 814 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldHaveCauseExactlyInstance.java | ShouldHaveCauseExactlyInstance | shouldHaveCauseExactlyInstance | class ShouldHaveCauseExactlyInstance extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link BasicErrorMessageFactory}</code>.
*
* @param actual the actual value in the failed assertion.
* @param expectedCauseType the expected cause instance.
* @return the created {@code ErrorMessageFacto... |
return actual.getCause() == null
? new ShouldHaveCauseExactlyInstance(expectedCauseType, actual)
: new ShouldHaveCauseExactlyInstance(actual, expectedCauseType);
| 378 | 54 | 432 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldHaveCauseInstance.java | ShouldHaveCauseInstance | shouldHaveCauseInstance | class ShouldHaveCauseInstance extends BasicErrorMessageFactory {
/**
* Creates a new <code>{@link org.assertj.core.error.BasicErrorMessageFactory}</code>.
*
* @param actual the actual value in the failed assertion.
* @param expectedCauseType the expected cause type.
* @return the created {@code Error... |
return actual.getCause() == null
? new ShouldHaveCauseInstance(expectedCauseType)
: new ShouldHaveCauseInstance(actual, expectedCauseType);
| 354 | 46 | 400 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldHaveDigest.java | ShouldHaveDigest | errorMessage | class ShouldHaveDigest extends BasicErrorMessageFactory {
public static ErrorMessageFactory shouldHaveDigest(Path actualSource, DigestDiff diff) {
return new ShouldHaveDigest(actualSource, diff);
}
public static ErrorMessageFactory shouldHaveDigest(File actualSource, DigestDiff diff) {
return new Should... |
return "%nExpecting " + actualType + " %s " + diff.getDigestAlgorithm() + " digest to be:%n" +
" %s%n" +
"but was:%n" +
" %s";
| 304 | 66 | 370 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldHaveDuration.java | ShouldHaveDuration | shouldHaveDays | class ShouldHaveDuration extends BasicErrorMessageFactory {
private static final String EXPECTED_PREFIX = "%n"
+ "Expecting Duration:%n"
+ " %s%n"
+ "to have %s ";
publi... |
String metric;
if (expectedDays == 1 || expectedDays == -1) {
metric = "day";
} else {
metric = "days";
}
return new ShouldHaveDuration(actual, actualDays, expectedDays, metric);
| 647 | 68 | 715 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldHaveExactlyTypes.java | ShouldHaveExactlyTypes | shouldHaveTypes | class ShouldHaveExactlyTypes extends BasicErrorMessageFactory {
public static ErrorMessageFactory shouldHaveTypes(Object actual, Iterable<Class<?>> expectedTypes,
Iterable<Class<?>> expectedTypesNotFoundInActual,
... |
if (!isNullOrEmpty(actualTypesNotExpected) && !isNullOrEmpty(expectedTypesNotFoundInActual)) {
return new ShouldHaveExactlyTypes(actual, expectedTypes, expectedTypesNotFoundInActual, actualTypesNotExpected);
}
// empty actualTypesNotExpected means expectedTypesNotFoundInActual is not empty
boolea... | 606 | 152 | 758 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldHaveExtension.java | ShouldHaveExtension | shouldHaveExtension | class ShouldHaveExtension extends BasicErrorMessageFactory {
public static ShouldHaveExtension shouldHaveExtension(File actual, String actualExtension, String expectedExtension) {<FILL_FUNCTION_BODY>}
public static ShouldHaveExtension shouldHaveExtension(Path actual, String actualExtension, String expectedExtensi... |
return actualExtension == null
? new ShouldHaveExtension(actual, expectedExtension)
: new ShouldHaveExtension(actual, actualExtension, expectedExtension);
| 300 | 39 | 339 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldHaveNoFields.java | ShouldHaveNoFields | fieldDescription | class ShouldHaveNoFields extends BasicErrorMessageFactory {
public static ErrorMessageFactory shouldHaveNoPublicFields(Class<?> actual, Set<String> fields) {
return new ShouldHaveNoFields(actual, fields, true, false);
}
public static ErrorMessageFactory shouldHaveNoDeclaredFields(Class<?> actual, Set<String... |
if (publik) {
return declared ? "public declared" : "public";
}
return declared ? "declared" : "";
| 231 | 38 | 269 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
assertj_assertj | assertj/assertj-core/src/main/java/org/assertj/core/error/ShouldHaveNoNullFields.java | ShouldHaveNoNullFields | shouldHaveNoNullFieldsExcept | class ShouldHaveNoNullFields extends BasicErrorMessageFactory {
private static final String EXPECTED_MULTIPLE = "%nExpecting%n %s%nto have a property or a field named %s.%n";
private static final String EXPECTED_SINGLE = "%nExpecting%n %s%nnot to have any null property or field, but %s was null.%n";
private st... |
if (rejectedFields.size() == 1) {
if (ignoredFields.isEmpty()) {
return new ShouldHaveNoNullFields(actual, rejectedFields.get(0));
}
return new ShouldHaveNoNullFields(actual, rejectedFields.get(0), ignoredFields);
}
if (ignoredFields.isEmpty()) {
return new ShouldHaveNoNullF... | 412 | 122 | 534 | <methods>public transient void <init>(java.lang.String, java.lang.Object[]) ,public java.lang.String create(org.assertj.core.description.Description, org.assertj.core.presentation.Representation) ,public java.lang.String create(org.assertj.core.description.Description) ,public java.lang.String create() ,public boolean ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.