Skip to content

Commit

Permalink
ErrorEventTest
Browse files Browse the repository at this point in the history
  • Loading branch information
coilysiren committed Jun 24, 2024
1 parent 50b16b2 commit a0f1d4e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ class ApiRequestEventTest {

ApiRequestEvent apiRequestEvent;

@Test
void testAsMessage() {
apiRequestEvent = new ApiRequestEvent();
apiRequestEvent.setUrl("localhost");
apiRequestEvent.setIpAddress("1.1.1.1");
assertEquals("request to localhost from 1.1.1.1", apiRequestEvent.asMessage());
}

@Test
void testContructor() {
assertDoesNotThrow(
Expand All @@ -29,6 +21,14 @@ void testContructor() {
);
}

@Test
void testAsMessage() {
apiRequestEvent = new ApiRequestEvent();
apiRequestEvent.setUrl("localhost");
apiRequestEvent.setIpAddress("1.1.1.1");
assertEquals("request to localhost from 1.1.1.1", apiRequestEvent.asMessage());
}

@Test
void testHashIt() {
assertNull(ApiRequestEvent.hashIt(null));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
package gov.cms.ab2d.eventclient.events;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;

import org.junit.jupiter.api.Test;

class ErrorEventTest {

ErrorEvent errorEvent;

@Test
void test() {
void testConstructor() {
assertDoesNotThrow(() -> {
new ErrorEvent(null, null, null, null);
new ErrorEvent("CMS", "1234", ErrorEvent.ErrorType.FILE_ALREADY_DELETED, "ERROR");
});
}

@Test
void testAsMessage() {
errorEvent = new ErrorEvent();
errorEvent.setJobId("1234");
errorEvent.setErrorType(ErrorEvent.ErrorType.FILE_ALREADY_DELETED);
errorEvent.setDescription("ERROR");
assertEquals("(1234): FILE_ALREADY_DELETED ERROR", errorEvent.asMessage());
}

}

0 comments on commit a0f1d4e

Please sign in to comment.