Skip to content

Commit

Permalink
Merge pull request #38 from CDOT-CV/testing/test-tim-deposit-with-ext…
Browse files Browse the repository at this point in the history
…ra-properties

Added unit test for depositing TIM with extra properties.
  • Loading branch information
drewjj authored Apr 25, 2023
2 parents effcc05 + 9daaf0f commit fdbed76
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void emptyRequestShouldReturnEmptyError() {

@Test
public void invalidJsonSyntaxShouldReturnJsonSyntaxError() {
ResponseEntity<String> actualResponse = testTimDepositController.postTim("{\"invalid\":\"json\"}}");
ResponseEntity<String> actualResponse = testTimDepositController.postTim("{\"in\"va}}}on\"}}");
assertEquals("{\"error\":\"Malformed or non-compliant JSON syntax.\"}", actualResponse.getBody());
}

Expand Down Expand Up @@ -160,4 +160,11 @@ public void testSuccessfulMessageReturnsSuccessMessagePut(@Capturing TimTransmog
assertEquals("{\"success\":\"true\"}", actualResponse.getBody());
}

@Test
public void testDepositingTimWithExtraProperties(@Capturing TimTransmogrifier capturingTimTransmogrifier, @Capturing XmlUtils capturingXmlUtils) {
String timToSubmit = "{\"request\":{\"rsus\":[],\"snmp\":{},\"randomProp1\":true,\"randomProp2\":\"hello world\"},\"tim\":{\"msgCnt\":\"13\",\"timeStamp\":\"2017-03-13T01:07:11-05:00\",\"randomProp3\":123,\"randomProp4\":{\"nestedProp1\":\"foo\",\"nestedProp2\":\"bar\"}}}";
ResponseEntity<String> actualResponse = testTimDepositController.postTim(timToSubmit);
assertEquals("{\"success\":\"true\"}", actualResponse.getBody());
}

}

0 comments on commit fdbed76

Please sign in to comment.