-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65e8341
commit 1f17f5b
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...-common/src/test/java/com/linkedin/venice/listener/response/HttpShortcutResponseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.linkedin.venice.listener.response; | ||
|
||
import static org.testng.Assert.assertEquals; | ||
|
||
import io.netty.handler.codec.http.HttpResponseStatus; | ||
import org.testng.annotations.Test; | ||
|
||
|
||
public class HttpShortcutResponseTest { | ||
@Test | ||
public void testHttpShortcutResponse() { | ||
// Case 1: Test constructor with both message and status | ||
HttpShortcutResponse responseWithMessage = new HttpShortcutResponse("Success", HttpResponseStatus.OK); | ||
assertEquals(responseWithMessage.getMessage(), "Success", "Message should be 'Success'"); | ||
assertEquals(responseWithMessage.getStatus(), HttpResponseStatus.OK, "Status should be OK"); | ||
|
||
// Case 2: Test constructor with empty message and status | ||
HttpShortcutResponse responseWithEmptyMessage = new HttpShortcutResponse("", HttpResponseStatus.BAD_REQUEST); | ||
assertEquals(responseWithEmptyMessage.getMessage(), "", "Message should be empty"); | ||
assertEquals(responseWithEmptyMessage.getStatus(), HttpResponseStatus.BAD_REQUEST, "Status should be BAD_REQUEST"); | ||
|
||
// Case 3: Test constructor with only status (default message) | ||
HttpShortcutResponse responseWithoutMessage = new HttpShortcutResponse(HttpResponseStatus.NOT_FOUND); | ||
assertEquals(responseWithoutMessage.getMessage(), "", "Message should be empty by default"); | ||
assertEquals(responseWithoutMessage.getStatus(), HttpResponseStatus.NOT_FOUND, "Status should be NOT_FOUND"); | ||
} | ||
} |