Skip to content

Commit 3046b11

Browse files
committed
Minor cleanups
1 parent c7c20d3 commit 3046b11

4 files changed

Lines changed: 18 additions & 7 deletions

File tree

.idea/misc.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/net/thauvin/erik/httpstatus/Reasons.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,7 @@ public static void main(String... args) {
153153
if (reasonClass.isPresent()) {
154154
var reasons = getReasonClass(reasonClass.get());
155155
reasons.forEach((k, v) -> System.out.println(k + ": " + v));
156-
} else {
157-
System.out.println("Invalid reason class: " + arg);
158156
}
159-
160157
} else { // e.g.: 404
161158
var value = REASON_PHRASES.get(arg);
162159
if (value != null) {

src/test/java/net/thauvin/erik/httpstatus/ReasonsMainTests.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static void setUpStreams() {
6565
}
6666

6767
@Test
68-
void mainWithArgsClass() {
68+
void mainWithClassArg() {
6969
Reasons.main("2xx");
7070
var lines = OUTPUT_STREAM.toString().split("\n");
7171
assertThat(lines).as("should be 13 reasons for 2xx").hasSize(13);
@@ -76,13 +76,18 @@ void mainWithArgsClass() {
7676
}
7777
}
7878

79-
8079
@Test
8180
void mainWithInvalidArg() {
8281
Reasons.main("aaa");
8382
assertThat(OUTPUT_STREAM.toString()).as("invalid argument: aaa").isEmpty();
8483
}
8584

85+
@Test
86+
void mainWithInvalidClassArg() {
87+
Reasons.main("6xx");
88+
assertThat(OUTPUT_STREAM.toString()).as("invalid argument: 6xx").isEmpty();
89+
}
90+
8691
@Test
8792
void mainWithMultipleArgs() {
8893
Reasons.main("500", "302");

src/test/java/net/thauvin/erik/httpstatus/taglibs/CauseTagTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ private String getOutputFromPageContext(PageContext pageContext) {
9292
@Nested
9393
@DisplayName("GetCause Tests")
9494
class GetCauseTests {
95-
final static String message = "This is the cause";
95+
static final String MESSAGE = "This is the cause";
9696

9797
@Test
9898
void cause() {
99-
assertThat(tag.getCause(new Exception(message))).as("has cause").isEqualTo(message);
99+
assertThat(tag.getCause(new Exception(MESSAGE))).as("has cause").isEqualTo(MESSAGE);
100100
}
101101

102102
@Test

0 commit comments

Comments
 (0)