Top Description Inners Fields Constructors Methods
org.assertj.core.description

public Class JoinDescription

extends Description
Class Inheritance
Static Imports
java.util.Objects.deepEquals, .Objects.requireNonNull, java.util.stream.Collectors.toList, org.assertj.core.util.Objects.HASH_CODE_PRIME, .Objects.hashCodeFor

The Description combining multiple Descriptions. It'll honor the nested descriptions and will indent them as appropriate.
Authors
Edgar Asatryan, Joel Costigliola

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
JoinDescription.IndentedAppendable

The wrapper for StringBuilder aware of indentation.

Field Summary

Modifier and TypeField and Description
private static final int
private static final String
DELIMITER

Delimiter string between descriptions.

pack-priv final Collection<Description>
private static final String
pack-priv final String
pack-priv final String

Constructor Summary

AccessConstructor and Description
public
JoinDescription(String
The beginning part of this description.
prefix
,
String
The ending part of this description.
suffix
,
Collection<Description>
The descriptions to combine.
descriptions
)

Creates a new JoinDescription.

Method Summary

Modifier and TypeMethod and Description
private JoinDescription.IndentedAppendable
private static Description
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public String
Inherited from org.assertj.core.description.Description:
emptyIfNullmostRelevantDescriptiontoString

Field Detail

DEFAULT_INDENTATIONback to summary
private static final int DEFAULT_INDENTATION
DELIMITERback to summary
private static final String DELIMITER

Delimiter string between descriptions.

descriptionsback to summary
pack-priv final Collection<Description> descriptions
Annotations
@VisibleForTesting
LINE_SEPARATORback to summary
private static final String LINE_SEPARATOR
prefixback to summary
pack-priv final String prefix
Annotations
@VisibleForTesting
suffixback to summary
pack-priv final String suffix
Annotations
@VisibleForTesting

Constructor Detail

JoinDescriptionback to summary
public JoinDescription(String prefix, String suffix, Collection<Description> descriptions)

Creates a new JoinDescription.

Parameters
prefix:String

The beginning part of this description.

suffix:String

The ending part of this description.

descriptions:Collection<Description>

The descriptions to combine.

Exceptions
NullPointerException:
  • if the given prefix is null.
  • if the given suffix is null.
  • if the given descriptions contains null elements or descriptions itself is null.

Method Detail

appendIndentedValueToback to summary
private JoinDescription.IndentedAppendable appendIndentedValueTo(JoinDescription.IndentedAppendable indentableBuilder)
checkNotNullback to summary
private static Description checkNotNull(Description description)
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
valueback to summary
public String value()

Implements abstract org.assertj.core.description.Description.value.

Returns:String

Doc from org.assertj.core.description.Description.value.

the value of this description.

Annotations
@Override
org.assertj.core.description back to summary

private Class JoinDescription.IndentedAppendable

extends Object
implements Appendable
Class Inheritance
  • java.lang.Object
  • org.assertj.core.description.JoinDescription.IndentedAppendable
All Implemented Interfaces
java.lang.Appendable

The wrapper for StringBuilder aware of indentation.

Field Summary

Modifier and TypeField and Description
private int
private final StringBuilder

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public JoinDescription.IndentedAppendable
append(CharSequence
The character sequence to append. If csq is null, then the four characters "null" are appended to this Appendable.
charSequence
)

Implements java.lang.Appendable.append.

Appends the specified character sequence to this Appendable.
public JoinDescription.IndentedAppendable
append(CharSequence
The character sequence from which a subsequence will be appended. If csq is null, then characters will be appended as if csq contained the four characters "null".
charSequence
,
int
The index of the first character in the subsequence
start
,
int
The index of the character following the last character in the subsequence
end
)

Implements java.lang.Appendable.append.

Appends a subsequence of the specified character sequence to this Appendable.
public JoinDescription.IndentedAppendable
append(char
The character to append
c
)

Implements java.lang.Appendable.append.

Appends the specified character to this Appendable.
pack-priv JoinDescription.IndentedAppendable

Returns:

a this instance.
changeIndentationBy
(int
The indentation adjustment.
indentation
)

Adjusts the indentation size by indentation.

pack-priv JoinDescription.IndentedAppendable

Returns:

a this instance.
indent
()

Appends the indentation according to current size.

pack-priv JoinDescription.IndentedAppendable

Returns:

a this instance.
indentBy
(int
The indentation adjustment.
indentation
)

Shortcut method from changeIndentationBy(int) and indent()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

currentIndentationback to summary
private int currentIndentation
stringBuilderback to summary
private final StringBuilder stringBuilder

Constructor Detail

IndentedAppendableback to summary
pack-priv IndentedAppendable(StringBuilder stringBuilder)

Method Detail

appendback to summary
public JoinDescription.IndentedAppendable append(CharSequence charSequence)

Implements java.lang.Appendable.append.

Doc from java.lang.Appendable.append.

Appends the specified character sequence to this Appendable.

Depending on which class implements the character sequence csq, the entire sequence may not be appended. For instance, if csq is a java.nio.CharBuffer then the subsequence to append is defined by the buffer's position and limit.

The contents of this Appendable are unspecified if the CharSequence is modified during the method call or an exception is thrown when accessing the CharSequence.

Parameters
charSequence:CharSequence

The character sequence to append. If csq is null, then the four characters "null" are appended to this Appendable.

Returns:JoinDescription.IndentedAppendable

A reference to this Appendable

Annotations
@Override
appendback to summary
public JoinDescription.IndentedAppendable append(CharSequence charSequence, int start, int end)

Implements java.lang.Appendable.append.

Doc from java.lang.Appendable.append.

Appends a subsequence of the specified character sequence to this Appendable.

An invocation of this method of the form out.append(csq, start, end) when csq is not null, behaves in exactly the same way as the invocation

    out.append(csq.subSequence(start, end)) 

The contents of this Appendable are unspecified if the CharSequence is modified during the method call or an exception is thrown when accessing the CharSequence.

Parameters
charSequence:CharSequence

The character sequence from which a subsequence will be appended. If csq is null, then characters will be appended as if csq contained the four characters "null".

start:int

The index of the first character in the subsequence

end:int

The index of the character following the last character in the subsequence

Returns:JoinDescription.IndentedAppendable

A reference to this Appendable

Annotations
@Override
appendback to summary
public JoinDescription.IndentedAppendable append(char c)

Implements java.lang.Appendable.append.

Doc from java.lang.Appendable.append.

Appends the specified character to this Appendable.

Parameters
c:char

The character to append

Returns:JoinDescription.IndentedAppendable

A reference to this Appendable

Annotations
@Override
changeIndentationByback to summary
pack-priv JoinDescription.IndentedAppendable changeIndentationBy(int indentation)

Adjusts the indentation size by indentation.

Parameters
indentation:int

The indentation adjustment.

Returns:JoinDescription.IndentedAppendable

a this instance.

indentback to summary
pack-priv JoinDescription.IndentedAppendable indent()

Appends the indentation according to current size.

Returns:JoinDescription.IndentedAppendable

a this instance.

indentByback to summary
pack-priv JoinDescription.IndentedAppendable indentBy(int indentation)

Shortcut method from changeIndentationBy(int) and indent()

Parameters
indentation:int

The indentation adjustment.

Returns:JoinDescription.IndentedAppendable

a this instance.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override