Skip to content

Commit 269b672

Browse files
chore: spotlessApply
1 parent 6cb6996 commit 269b672

File tree

1 file changed

+77
-31
lines changed
  • lesson_16/objects/objects_app/src/test/java/com/codedifferently/lesson16/xaviercruz

1 file changed

+77
-31
lines changed
Lines changed: 77 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,55 @@
11
package com.codedifferently.lesson16.xaviercruz;
22

3-
import java.util.ArrayList;
4-
import java.util.Arrays;
5-
63
import static org.junit.jupiter.api.Assertions.assertEquals;
74
import static org.junit.jupiter.api.Assertions.assertThrows;
5+
6+
import java.util.ArrayList;
7+
import java.util.Arrays;
88
import org.junit.jupiter.api.Test;
99

1010
public class PersonTest {
11-
Person person = new Person("That one guy right there", 25, Position.ARSONIST, new ArrayList<>(Arrays.asList("Tall", "Insane", "Funny", "something else here idk")), Color.RED);
11+
Person person =
12+
new Person(
13+
"That one guy right there",
14+
25,
15+
Position.ARSONIST,
16+
new ArrayList<>(Arrays.asList("Tall", "Insane", "Funny", "something else here idk")),
17+
Color.RED);
1218

1319
@Test
14-
public void testGetName(){
20+
public void testGetName() {
1521
assertEquals("That one guy right there", person.getName());
1622
}
1723

1824
@Test
19-
public void testChangeName(){
25+
public void testChangeName() {
2026
person.changeName("new name right here bruh");
2127
assertEquals("new name right here bruh", person.getName());
2228
}
2329

2430
@Test
25-
public void testGetAge(){
31+
public void testGetAge() {
2632
assertEquals(25, person.getAge());
2733
}
2834

2935
@Test
30-
public void testGetPosition(){
36+
public void testGetPosition() {
3137
assertEquals(Position.ARSONIST, person.getPosition());
3238
}
3339

3440
@Test
35-
public void testGetTraits(){
36-
assertEquals(new ArrayList<>(Arrays.asList("Tall", "Insane", "Funny", "something else here idk")), person.getTraits());
41+
public void testGetTraits() {
42+
assertEquals(
43+
new ArrayList<>(Arrays.asList("Tall", "Insane", "Funny", "something else here idk")),
44+
person.getTraits());
3745
}
3846

3947
@Test
40-
public void testGetEyeColor(){
48+
public void testGetEyeColor() {
4149
assertEquals(Color.RED, person.getEyeColor());
4250
}
4351

44-
@Test
52+
@Test
4553
public void testSetEyeColor() {
4654
Color color = Color.GREEN;
4755

@@ -50,42 +58,80 @@ public void testSetEyeColor() {
5058
assertEquals(Color.GREEN, person.getEyeColor());
5159
}
5260

53-
5461
@Test
55-
public void testIncreaseAge(){
62+
public void testIncreaseAge() {
5663
person.increaseAge();
5764
assertEquals(26, person.getAge());
5865
}
5966

6067
@Test
61-
public void testUpdateAge(){
68+
public void testUpdateAge() {
6269
person.updateAge(99);
6370
assertEquals(99, person.getAge());
6471
}
6572

6673
@Test
67-
public void testAddToTraitsStringArray_Exception(){
68-
String[] newTraits = new String[]{"test", "test", "test", "test", "test", "test", "test"};
69-
assertThrows(TooManyTraitsException.class, () -> {
70-
person.addToTraits(newTraits);
71-
});
74+
public void testAddToTraitsStringArray_Exception() {
75+
String[] newTraits = new String[] {"test", "test", "test", "test", "test", "test", "test"};
76+
assertThrows(
77+
TooManyTraitsException.class,
78+
() -> {
79+
person.addToTraits(newTraits);
80+
});
7281
}
7382

7483
@Test
75-
public void testAddToTraitsString_Exception(){
76-
Person person2 = new Person("That one guy right there", 25, Position.ARSONIST, new ArrayList<>(Arrays.asList("Tall", "Insane", "Funny", "something else here idk", "test", "test", "test","test","test","test")), Color.RED);
77-
assertThrows(TooManyTraitsException.class, () -> {
78-
person2.addToTraits("newTrait");
79-
});
84+
public void testAddToTraitsString_Exception() {
85+
Person person2 =
86+
new Person(
87+
"That one guy right there",
88+
25,
89+
Position.ARSONIST,
90+
new ArrayList<>(
91+
Arrays.asList(
92+
"Tall",
93+
"Insane",
94+
"Funny",
95+
"something else here idk",
96+
"test",
97+
"test",
98+
"test",
99+
"test",
100+
"test",
101+
"test")),
102+
Color.RED);
103+
assertThrows(
104+
TooManyTraitsException.class,
105+
() -> {
106+
person2.addToTraits("newTrait");
107+
});
80108
}
81109

82110
@Test
83-
public void testAddToTraitsList_Exception(){
84-
Person person2 = new Person("That one guy right there", 25, Position.ARSONIST, new ArrayList<>(Arrays.asList("Tall", "Insane", "Funny", "something else here idk", "test", "test", "test","test","test","test")), Color.RED);
111+
public void testAddToTraitsList_Exception() {
112+
Person person2 =
113+
new Person(
114+
"That one guy right there",
115+
25,
116+
Position.ARSONIST,
117+
new ArrayList<>(
118+
Arrays.asList(
119+
"Tall",
120+
"Insane",
121+
"Funny",
122+
"something else here idk",
123+
"test",
124+
"test",
125+
"test",
126+
"test",
127+
"test",
128+
"test")),
129+
Color.RED);
85130
var traits = new ArrayList<String>(Arrays.asList("testTrait"));
86-
assertThrows(TooManyTraitsException.class, () -> {
87-
person2.addToTraits(traits);
88-
});
131+
assertThrows(
132+
TooManyTraitsException.class,
133+
() -> {
134+
person2.addToTraits(traits);
135+
});
89136
}
90-
91137
}

0 commit comments

Comments
 (0)