File tree 3 files changed +22
-26
lines changed
builder/src/main/java/com/iluwatar/builder
dao/src/test/java/com/iluwatar/dao
step-builder/src/main/java/com/iluwatar/stepbuilder
3 files changed +22
-26
lines changed Original file line number Diff line number Diff line change @@ -42,29 +42,25 @@ public Weapon getWeapon() {
42
42
public String toString () {
43
43
44
44
StringBuilder sb = new StringBuilder ();
45
- sb .append ("This is a " );
46
- sb .append (profession );
47
- sb .append (" named " );
48
- sb .append (name );
45
+ sb .append ("This is a " )
46
+ .append (profession )
47
+ .append (" named " )
48
+ .append (name );
49
49
if (hairColor != null || hairType != null ) {
50
50
sb .append (" with " );
51
51
if (hairColor != null ) {
52
- sb .append (hairColor );
53
- sb .append (" " );
52
+ sb .append (hairColor ).append (" " );
54
53
}
55
54
if (hairType != null ) {
56
- sb .append (hairType );
57
- sb .append (" " );
55
+ sb .append (hairType ).append (" " );
58
56
}
59
57
sb .append (hairType != HairType .BALD ? "hair" : "head" );
60
58
}
61
59
if (armor != null ) {
62
- sb .append (" wearing " );
63
- sb .append (armor );
60
+ sb .append (" wearing " ).append (armor );
64
61
}
65
62
if (weapon != null ) {
66
- sb .append (" and wielding a " );
67
- sb .append (weapon );
63
+ sb .append (" and wielding a " ).append (weapon );
68
64
}
69
65
sb .append ("." );
70
66
return sb .toString ();
Original file line number Diff line number Diff line change @@ -63,12 +63,12 @@ public void equalsWithSameObjects() {
63
63
@ Test
64
64
public void testToString () {
65
65
final StringBuffer buffer = new StringBuffer ();
66
- buffer .append ("Customer{id=" );
67
- buffer .append ("" + customer .getId ());
68
- buffer .append (", firstName='" );
69
- buffer .append (customer .getFirstName ());
70
- buffer .append ("\' , lastName='" );
71
- buffer .append (customer .getLastName () + "\' }" );
66
+ buffer .append ("Customer{id=" )
67
+ .append ("" + customer .getId ())
68
+ .append (", firstName='" )
69
+ .append (customer .getFirstName ())
70
+ .append ("\' , lastName='" )
71
+ .append (customer .getLastName () + "\' }" );
72
72
assertEquals (buffer .toString (), customer .toString ());
73
73
}
74
74
}
Original file line number Diff line number Diff line change @@ -69,14 +69,14 @@ public void setAbilities(List<String> abilities) {
69
69
@ Override
70
70
public String toString () {
71
71
StringBuilder sb = new StringBuilder ();
72
- sb .append ("This is a " );
73
- sb .append (fighterClass != null ? fighterClass : wizardClass );
74
- sb .append (" named " );
75
- sb .append (name );
76
- sb .append (" armed with a " );
77
- sb .append (weapon != null ? weapon : spell != null ? spell : "with nothing" );
78
- sb .append (abilities != null ? (" and wielding " + abilities + " abilities" ) : "" );
79
- sb .append ("." );
72
+ sb .append ("This is a " )
73
+ .append (fighterClass != null ? fighterClass : wizardClass )
74
+ .append (" named " )
75
+ .append (name )
76
+ .append (" armed with a " )
77
+ .append (weapon != null ? weapon : spell != null ? spell : "with nothing" )
78
+ .append (abilities != null ? (" and wielding " + abilities + " abilities" ) : "" )
79
+ .append ("." );
80
80
return sb .toString ();
81
81
}
82
82
}
You can’t perform that action at this time.
0 commit comments