Skip to content

Commit fec5d6d

Browse files
committed
Fixed empty catch block warnings.
The test signature: test... throws FlashcardSetCreationFailed was misleading because the test itself doesn't throw an exception, but checks for it in the method body, so I changed it. Fixed the empty catch warnings by renaming 'catch' parameter to 'ignored'.
1 parent 482878b commit fec5d6d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/test/java/create_flashcard_set_use_case/FlashcardSetInteractorTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public FlashcardSetResponseModel prepareFailView(String error) {
6565
}
6666

6767
@Test
68-
public void testMissingTitleException() throws FlashcardSetCreationFailed {
68+
public void testMissingTitleException() {
6969
// Create a mock user input with no title
7070
FlashcardSetRequestModel requestModel = new FlashcardSetRequestModel("",
7171
"Final Exam Review", false, "uncle_bob69");
@@ -92,14 +92,14 @@ public FlashcardSetResponseModel prepareFailView(String error) {
9292
try {
9393
interactor.create(requestModel); // no title should go immediately to catch block (i.e., pass test)
9494
assert (false); // if title is included, then this line is reached and test fails
95-
} catch (FlashcardSetCreationFailed e) {
95+
} catch (FlashcardSetCreationFailed ignored) {
9696

9797
}
9898

9999
}
100100

101101
@Test
102-
public void testMissingDescriptionException() throws FlashcardSetCreationFailed {
102+
public void testMissingDescriptionException() {
103103
// Create a mock user input with no description
104104
FlashcardSetRequestModel requestModel = new FlashcardSetRequestModel("CSC207",
105105
"", false, "uncle_bob69");
@@ -126,14 +126,14 @@ public FlashcardSetResponseModel prepareFailView(String error) {
126126
try {
127127
interactor.create(requestModel);
128128
assert (false);
129-
} catch (FlashcardSetCreationFailed e) {
129+
} catch (FlashcardSetCreationFailed ignored) {
130130

131131
}
132132

133133
}
134134

135135
@Test
136-
public void testMissingUsernameException() throws FlashcardSetCreationFailed {
136+
public void testMissingUsernameException() {
137137
// Create a mock user input with no username
138138
FlashcardSetRequestModel requestModel = new FlashcardSetRequestModel("CSC207",
139139
"Final Exam Review", false, "");
@@ -160,7 +160,7 @@ public FlashcardSetResponseModel prepareFailView(String error) {
160160
try {
161161
interactor.create(requestModel);
162162
assert (false);
163-
} catch (FlashcardSetCreationFailed e) {
163+
} catch (FlashcardSetCreationFailed ignored) {
164164

165165
}
166166

0 commit comments

Comments
 (0)