Skip to content

Commit 15ac95c

Browse files
github-actionsgithub-actions
github-actions
authored and
github-actions
committed
Formatted with Google Java Formatter
1 parent da08aae commit 15ac95c

File tree

9 files changed

+34
-48
lines changed

9 files changed

+34
-48
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
package com.examplehub.basics.collection;
22

3-
public class CollectionsExample {
4-
}
3+
public class CollectionsExample {}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
package com.examplehub.basics.collection;
22

3-
public class ListExample {
4-
}
3+
public class ListExample {}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
package com.examplehub.basics.collection;
22

3-
public class StackExample {
4-
}
3+
public class StackExample {}

src/test/java/com/examplehub/basics/HashMapExampleTest.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import java.util.HashMap;
66
import java.util.Map;
7-
87
import org.junit.jupiter.api.Test;
98

109
class HashMapExampleTest {
@@ -22,8 +21,8 @@ void testPut() {
2221
assertEquals("admin", hashMap.put("username", "admin_username"));
2322
assertEquals("admin_username", hashMap.get("username"));
2423

25-
assertEquals("{password=abc123, bio=I love coding, username=admin_username}",
26-
hashMap.toString());
24+
assertEquals(
25+
"{password=abc123, bio=I love coding, username=admin_username}", hashMap.toString());
2726
}
2827

2928
@Test
@@ -122,10 +121,10 @@ void testKeySet() {
122121
assertEquals("[password, username]", hashMap.keySet().toString());
123122

124123
String[][] keyValues =
125-
new String[][]{
126-
{"password", "abc123"},
127-
{"username", "admin"}
128-
};
124+
new String[][] {
125+
{"password", "abc123"},
126+
{"username", "admin"}
127+
};
129128
int index = 0;
130129
for (String key : hashMap.keySet()) {
131130
assertEquals(keyValues[index][0], key);
@@ -157,10 +156,10 @@ void testEntry() {
157156
hashMap.put("username", "admin");
158157
hashMap.put("password", "abc123");
159158
String[][] keyValues =
160-
new String[][]{
161-
{"password", "abc123"},
162-
{"username", "admin"}
163-
};
159+
new String[][] {
160+
{"password", "abc123"},
161+
{"username", "admin"}
162+
};
164163
int index = 0;
165164
for (Map.Entry<String, String> entry : hashMap.entrySet()) {
166165
assertEquals(keyValues[index][0], entry.getKey());

src/test/java/com/examplehub/basics/collection/CollectionsExampleTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package com.examplehub.basics.collection;
22

3-
import org.junit.jupiter.api.Test;
3+
import static org.junit.jupiter.api.Assertions.*;
44

5-
import java.util.ArrayList;
65
import java.util.Arrays;
76
import java.util.Collections;
87
import java.util.List;
9-
10-
import static org.junit.jupiter.api.Assertions.*;
8+
import org.junit.jupiter.api.Test;
119

1210
class CollectionsExampleTest {
1311
@Test
@@ -57,4 +55,4 @@ void testCopy() {
5755
Collections.copy(dist, src);
5856
assertEquals("[1, 2, 3, 4, 5, 6]", dist.toString());
5957
}
60-
}
58+
}

src/test/java/com/examplehub/basics/collection/ListExampleTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package com.examplehub.basics.collection;
22

3-
import org.junit.jupiter.api.Test;
3+
import static org.junit.jupiter.api.Assertions.*;
44

55
import java.util.LinkedList;
66
import java.util.List;
7-
8-
import static org.junit.jupiter.api.Assertions.*;
7+
import org.junit.jupiter.api.Test;
98

109
public class ListExampleTest {
1110
@Test

src/test/java/com/examplehub/basics/set/HashSetExampleTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package com.examplehub.basics.set;
22

3-
import org.junit.jupiter.api.Test;
3+
import static org.junit.jupiter.api.Assertions.*;
44

55
import java.util.HashSet;
66
import java.util.Set;
7-
8-
import static org.junit.jupiter.api.Assertions.*;
7+
import org.junit.jupiter.api.Test;
98

109
class HashSetExampleTest {
1110
@Test
@@ -41,4 +40,4 @@ void testClear() {
4140
set.clear();
4241
assertEquals("[]", set.toString());
4342
}
44-
}
43+
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
package com.examplehub.basics.set;
22

3-
import org.junit.jupiter.api.Test;
3+
import static org.junit.jupiter.api.Assertions.*;
44

55
import java.util.LinkedHashSet;
66
import java.util.Set;
7-
8-
import static org.junit.jupiter.api.Assertions.*;
7+
import org.junit.jupiter.api.Test;
98

109
class LinkedListExampleTest {
1110
@Test
@@ -17,4 +16,4 @@ void testAdd() {
1716
assertTrue(set.add(1));
1817
assertEquals("[2, 3, 1]", set.toString());
1918
}
20-
}
19+
}

src/test/java/com/examplehub/basics/set/TreeSetExampleTest.java

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
import static org.junit.jupiter.api.Assertions.*;
44

5-
import java.util.Comparator;
65
import java.util.Set;
76
import java.util.TreeSet;
8-
97
import org.junit.jupiter.api.Test;
108

119
class TreeSetExampleTest {
@@ -40,10 +38,7 @@ public int getAge() {
4038

4139
@Override
4240
public String toString() {
43-
return "Student{" +
44-
"name='" + name + '\'' +
45-
", age=" + age +
46-
'}';
41+
return "Student{" + "name='" + name + '\'' + ", age=" + age + '}';
4742
}
4843

4944
@Override
@@ -61,13 +56,14 @@ public int compareTo(Student o) {
6156
set.add(s2);
6257
set.add(s3);
6358

64-
assertEquals("[Student{name='Zara', age=21}, Student{name='Tom', age=22}, Student{name='Jack', age=23}]"
65-
, set.toString());
59+
assertEquals(
60+
"[Student{name='Zara', age=21}, Student{name='Tom', age=22}, Student{name='Jack', age=23}]",
61+
set.toString());
6662
}
6763

6864
@Test
6965
void testComparator() {
70-
class Student{
66+
class Student {
7167
private final String name;
7268
private final int age;
7369

@@ -83,12 +79,10 @@ public String getName() {
8379
public int getAge() {
8480
return age;
8581
}
82+
8683
@Override
8784
public String toString() {
88-
return "Student{" +
89-
"name='" + name + '\'' +
90-
", age=" + age +
91-
'}';
85+
return "Student{" + "name='" + name + '\'' + ", age=" + age + '}';
9286
}
9387
}
9488

@@ -101,7 +95,8 @@ public String toString() {
10195
set.add(s2);
10296
set.add(s3);
10397

104-
assertEquals("[Student{name='Zara', age=21}, Student{name='Tom', age=22}, Student{name='Jack', age=23}]"
105-
, set.toString());
98+
assertEquals(
99+
"[Student{name='Zara', age=21}, Student{name='Tom', age=22}, Student{name='Jack', age=23}]",
100+
set.toString());
106101
}
107102
}

0 commit comments

Comments
 (0)