Skip to content

Commit 77f2e0e

Browse files
committed
Comments for tests
1 parent 1f5c1d8 commit 77f2e0e

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

src/test/java/org/hydev/mcpm/client/database/SearchInteractorTest.java

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
/**
1818
* Test suite for the SearchInteractor class.
19-
*
20-
* @author Jerry Zhu (<a href="https://github.com/jerryzhu509">...</a>)
2119
*/
2220
public class SearchInteractorTest {
2321
private static SearchInteractor database;
@@ -50,6 +48,10 @@ private String formatStr(SearchPackagesResult result, String delim) {
5048
.collect(Collectors.joining(delim));
5149
}
5250

51+
/**
52+
* Tests search by name when there is a match. Using lower-case to ensure that the search is not
53+
* case-sensitive.
54+
*/
5355
@Test
5456
void testSearchByNameSuccessMatch() {
5557
var result = database.search(
@@ -58,9 +60,12 @@ void testSearchByNameSuccessMatch() {
5860
assertEquals(result.state(), SearchPackagesResult.State.SUCCESS);
5961

6062
var text = formatStr(result, ", ");
61-
assertEquals(text, "Multiverse-Core");
63+
assertEquals("Multiverse-Core", text);
6264
}
6365

66+
/**
67+
* Tests search by name when there is no match. Expect an empty string.
68+
*/
6469
@Test
6570
void testSearchByNameSuccessNoMatch() {
6671
var result = database.search(
@@ -69,9 +74,12 @@ void testSearchByNameSuccessNoMatch() {
6974
assertEquals(result.state(), SearchPackagesResult.State.SUCCESS);
7075

7176
var text = formatStr(result, ", ");
72-
assertEquals(text, "");
77+
assertEquals("", text);
7378
}
7479

80+
/**
81+
* Tests search by keyword when there is a match.
82+
*/
7583
@Test
7684
void testSearchByKeywordSuccessMatch() {
7785
var result = database.search(
@@ -80,9 +88,12 @@ void testSearchByKeywordSuccessMatch() {
8088
assertEquals(result.state(), SearchPackagesResult.State.SUCCESS);
8189

8290
var text = formatStr(result, ", ");
83-
assertEquals(text, "Holographic Displays, WorldGuard");
91+
assertEquals("Holographic Displays, WorldGuard", text);
8492
}
8593

94+
/**
95+
* Tests search by keyword when there is no match. Expect an empty string.
96+
*/
8697
@Test
8798
void testSearchByKeywordSuccessNoMatch() {
8899
var result = database.search(
@@ -91,9 +102,13 @@ void testSearchByKeywordSuccessNoMatch() {
91102
assertEquals(result.state(), SearchPackagesResult.State.SUCCESS);
92103

93104
var text = formatStr(result, ", ");
94-
assertEquals(text, "");
105+
assertEquals("", text);
95106
}
96107

108+
109+
/**
110+
* Tests search by command when there is a match.
111+
*/
97112
@Test
98113
@SuppressWarnings("SpellCheckingInspection")
99114
void testSearchByCommandSuccessMatch() {
@@ -103,9 +118,13 @@ void testSearchByCommandSuccessMatch() {
103118
assertEquals(result.state(), SearchPackagesResult.State.SUCCESS);
104119

105120
var text = formatStr(result, ", ");
106-
assertEquals(text, "WorldGuard, Holographic Displays");
121+
assertEquals("WorldGuard, Holographic Displays", text);
107122
}
108123

124+
125+
/**
126+
* Tests search by command when there is no match.
127+
*/
109128
@Test
110129
void testSearchByCommandSuccessNoMatch() {
111130
var result = database.search(
@@ -114,9 +133,12 @@ void testSearchByCommandSuccessNoMatch() {
114133
assertEquals(result.state(), SearchPackagesResult.State.SUCCESS);
115134

116135
var text = formatStr(result, ", ");
117-
assertEquals(text, "");
136+
assertEquals("", text);
118137
}
119138

139+
/**
140+
* Tests invalid searches due to empty inputs.
141+
*/
120142
@Test
121143
void testInvalidSearch() {
122144
var result1 = database.search(

0 commit comments

Comments
 (0)