Skip to content

Commit 7827265

Browse files
Remove <> from ShouldBeEqualByComparingOnlyGivenFields, ShouldBeEqualToIgnoringFields, ShouldBeEqualWithinOffset, ShouldBeEqualWithinPercentage, ShouldBeEqualWithTimePrecision, ShouldBeEven, ShouldBeExactlyInstanceOf, ShouldBeExecutable, ShouldBeFile, ShouldBeFinite, ShouldBeGreater, ShouldBeGreaterOrEqual, ShouldBeIn and ShouldBeInfinite.
1 parent c8c149c commit 7827265

54 files changed

Lines changed: 211 additions & 194 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/org/assertj/core/error/ShouldBeEqualByComparingOnlyGivenFields.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* Creates an <code>{@link AssertionError}</code> indicating that an assertion that verifies that two objects are
1919
* lenient equal by accepting fields failed.
20-
*
20+
*
2121
* @author Nicolas François
2222
* @author Joel Costigliola
2323
*/
@@ -35,26 +35,35 @@ public class ShouldBeEqualByComparingOnlyGivenFields extends BasicErrorMessageFa
3535
* @return the created {@code ErrorMessageFactory}.
3636
*/
3737
public static ErrorMessageFactory shouldBeEqualComparingOnlyGivenFields(Object actual, List<String> rejectedFields,
38-
List<Object> rejectedValues, List<Object> expectedValues,
38+
List<Object> rejectedValues,
39+
List<Object> expectedValues,
3940
List<String> acceptedFields) {
4041
if (rejectedFields.size() == 1) {
41-
return new ShouldBeEqualByComparingOnlyGivenFields(actual, rejectedFields.get(0), rejectedValues.get(0), expectedValues.get(0),
42-
acceptedFields);
42+
return new ShouldBeEqualByComparingOnlyGivenFields(actual, rejectedFields.get(0), rejectedValues.get(0),
43+
expectedValues.get(0),
44+
acceptedFields);
4345
}
4446
return new ShouldBeEqualByComparingOnlyGivenFields(actual, rejectedFields, rejectedValues, expectedValues,
4547
acceptedFields);
4648
}
4749

4850
private ShouldBeEqualByComparingOnlyGivenFields(Object actual, List<String> rejectedFields, List<Object> rejectedValues,
4951
List<Object> expectedValue, List<String> acceptedFields) {
50-
super("%nExpecting values:%n <%s>%nin fields:%n <%s>%nbut were:%n <%s>%nin <%s>.%nComparison was performed on fields:%n <%s>",
51-
expectedValue, rejectedFields, rejectedValues, actual, acceptedFields);
52+
super("%nExpecting values:%n"
53+
+ " %s%n"
54+
+ "in fields:%n"
55+
+ " %s%n"
56+
+ "but were:%n"
57+
+ " %s%n"
58+
+ "in %s.%n"
59+
+ "Comparison was performed on fields:%n %s",
60+
expectedValue, rejectedFields, rejectedValues, actual, acceptedFields);
5261
}
5362

5463
private ShouldBeEqualByComparingOnlyGivenFields(Object actual, String rejectedField, Object rejectedValue, Object expectedValue,
55-
List<String> acceptedFields) {
56-
super("%nExpecting value <%s> in field <%s> but was <%s> in <%s>", expectedValue, rejectedField, rejectedValue, actual,
57-
acceptedFields);
64+
List<String> acceptedFields) {
65+
super("%nExpecting value %s in field %s but was %s in %s", expectedValue, rejectedField, rejectedValue, actual,
66+
acceptedFields);
5867
}
5968

6069
}

src/main/java/org/assertj/core/error/ShouldBeEqualToIgnoringFields.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
/**
1818
* Creates an <code>{@link AssertionError}</code> indicating that an assertion that verifies that two objects are lenient equal by
1919
* ignoring fields failed.
20-
*
20+
*
2121
* @author Nicolas François
2222
* @author Joel Costigliola
2323
*/
2424
public class ShouldBeEqualToIgnoringFields extends BasicErrorMessageFactory {
2525

26-
private static final String EXPECTED_MULTIPLE = "%nExpecting values:%n <%s>%nin fields:%n <%s>%nbut were:%n <%s>%nin <%s>.%n";
27-
private static final String EXPECTED_SINGLE = "%nExpecting value <%s> in field <%s> but was <%s> in <%s>.%n";
26+
private static final String EXPECTED_MULTIPLE = "%nExpecting values:%n %s%nin fields:%n %s%nbut were:%n %s%nin %s.%n";
27+
private static final String EXPECTED_SINGLE = "%nExpecting value %s in field %s but was %s in %s.%n";
2828
private static final String COMPARISON = "Comparison was performed on all fields";
29-
private static final String EXCLUDING = " but <%s>";
29+
private static final String EXCLUDING = " but %s";
3030

3131
/**
3232
* Creates a new <code>{@link ShouldBeEqualToIgnoringFields}</code>.

src/main/java/org/assertj/core/error/ShouldBeEqualWithTimePrecision.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ private static String buildErrorMessageTemplate(final TimeUnit precision) {
5555
fields = ", day, hour, minute";
5656
lastField = "second";
5757
}
58-
return "%nExpecting:%n <%s>%nto have same year, month" + fields + " and " + lastField + " as:%n <%s>%nbut had " +
59-
"not.";
58+
return "%nExpecting:%n" +
59+
" %s%n" +
60+
"to have same year, month" + fields + " and " + lastField + " as:%n" +
61+
" %s%n" +
62+
"but had not.";
6063
}
6164

6265
}

src/main/java/org/assertj/core/error/ShouldBeEqualWithinOffset.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ private <T extends Number> ShouldBeEqualWithinOffset(Number actual, Number expec
4040
Number difference) {
4141
super("%n" +
4242
"Expecting:%n" +
43-
" <%s>%n" +
43+
" %s%n" +
4444
"to be close to:%n" +
45-
" <%s>%n" +
46-
"by less than <%s> but difference was <%s>.%n" +
47-
"(a difference of exactly <%s> being considered " + validOrNot(offset) + ")",
45+
" %s%n" +
46+
"by less than %s but difference was %s.%n" +
47+
"(a difference of exactly %s being considered " + validOrNot(offset) + ")",
4848
actual, expected, offset.value, difference, offset.value);
4949
}
5050

src/main/java/org/assertj/core/error/ShouldBeEqualWithinPercentage.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ public static <T extends Number> ErrorMessageFactory shouldBeEqualWithinPercenta
4040
}
4141

4242
private ShouldBeEqualWithinPercentage(Number actual, Number expected, Percentage percentage,
43-
double expectedPercentage) {
43+
double expectedPercentage) {
4444
super("%nExpecting:%n" +
45-
" <%s>%n" +
45+
" %s%n" +
4646
"to be close to:%n" +
47-
" <%s>%n" +
47+
" %s%n" +
4848
"by less than %s but difference was %s%%.%n" +
4949
"(a difference of exactly %s being considered valid)",
5050
actual, expected, percentage, expectedPercentage, percentage);

src/main/java/org/assertj/core/error/ShouldBeEven.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ public static ErrorMessageFactory shouldBeEven(Number actual) {
2929
}
3030

3131
private ShouldBeEven(Number actual) {
32-
super("%nExpecting <%s> to be even", actual);
32+
super("%nExpecting %s to be even", actual);
3333
}
3434
}

src/main/java/org/assertj/core/error/ShouldBeExactlyInstanceOf.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static ErrorMessageFactory shouldBeExactlyInstance(Object actual, Class<?
3434
}
3535

3636
private ShouldBeExactlyInstanceOf(Object actual, Class<?> type) {
37-
super("%nExpecting:%n <%s>%nto be exactly an instance of:%n <%s>%nbut was an instance of:%n <%s>", actual, type,
37+
super("%nExpecting:%n %s%nto be exactly an instance of:%n %s%nbut was an instance of:%n %s", actual, type,
3838
actual.getClass());
3939
}
4040

src/main/java/org/assertj/core/error/ShouldBeExecutable.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,33 @@
1818
/**
1919
* Creates an error message indicating that an assertion that verifies that a <code>{@link File}</code> is executable
2020
* failed.
21-
*
21+
*
2222
* @author Olivier Demeijer
23-
*
23+
*
2424
*/
2525
public class ShouldBeExecutable extends BasicErrorMessageFactory {
26-
static final String SHOULD_BE_EXECUTABLE = "%nExpecting:%n <%s>%nto be executable.";
26+
private static final String SHOULD_BE_EXECUTABLE = "%nExpecting:%n %s%nto be executable.";
2727

2828
private ShouldBeExecutable(File actual) {
29-
super(SHOULD_BE_EXECUTABLE, actual);
29+
super(SHOULD_BE_EXECUTABLE, actual);
3030
}
3131

3232
private ShouldBeExecutable(Path actual) {
33-
super(SHOULD_BE_EXECUTABLE, actual);
33+
super(SHOULD_BE_EXECUTABLE, actual);
3434
}
3535

3636
/**
3737
* Creates a new <code>{@link ShouldBeExecutable}</code>.
38-
*
38+
*
3939
* @param actual the actual value in the failed assertion.
4040
* @return the created {@code ErrorMessageFactory}.
4141
*/
4242
public static ErrorMessageFactory shouldBeExecutable(File actual) {
43-
return new ShouldBeExecutable(actual);
43+
return new ShouldBeExecutable(actual);
4444
}
4545

4646
public static ErrorMessageFactory shouldBeExecutable(Path actual) {
47-
return new ShouldBeExecutable(actual);
47+
return new ShouldBeExecutable(actual);
4848
}
4949

5050
}

src/main/java/org/assertj/core/error/ShouldBeFile.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* Creates an error message indicating that an assertion that verifies that a <code>{@link File}</code> is an existing file
1919
* failed.
20-
*
20+
*
2121
* @author Yvonne Wang
2222
*/
2323
public class ShouldBeFile extends BasicErrorMessageFactory {
@@ -32,6 +32,6 @@ public static ErrorMessageFactory shouldBeFile(File actual) {
3232
}
3333

3434
private ShouldBeFile(File actual) {
35-
super("%nExpecting:%n <%s>%nto be a file", actual);
35+
super("%nExpecting:%n %s%nto be a file", actual);
3636
}
3737
}

src/main/java/org/assertj/core/error/ShouldBeFinite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ public static ErrorMessageFactory shouldBeFinite(Number actual) {
1919
}
2020

2121
private ShouldBeFinite(Number actual) {
22-
super("%nExpecting <%s> to be finite", actual);
22+
super("%nExpecting %s to be finite", actual);
2323
}
2424
}

0 commit comments

Comments
 (0)