-
Notifications
You must be signed in to change notification settings - Fork 6
Cfe04 transform endpoints refactored separately #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Cfe04 transform endpoints refactored separately #171
Conversation
7cdbc64 to
569eaa9
Compare
| String state = error + "-" + ((SQLException) cause).getSQLState(); | ||
| JSONObject jsonErr = new JSONObject(); | ||
| jsonErr.put("id", newCfe04Transform.getId()); | ||
| if (state.equals("1452-23000")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use && instead of string concat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swapped.
| public ResponseEntity<String> addNewCfe04Transform(@RequestBody Cfe04Transform newCfe04Transform) { | ||
| @ApiResponse(responseCode = "404", description = "Cfe04 does not exist", | ||
| content = @Content), | ||
| @ApiResponse(responseCode = "500", description = "Internal server error, contact admin", content = @Content)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
500 not necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
500 swapped to 400
| @ApiResponse(responseCode = "200", description = "cfe_04 transforms retrieved", | ||
| content = {@Content(mediaType = "application/json", | ||
| schema = @Schema(implementation = Cfe04Transform.class))}), | ||
| @ApiResponse(responseCode = "500", description = "Internal server error, contact admin", content = @Content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
500
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
500 swapped to 400
| @ApiResponse(responseCode = "500", description = "Internal server error, contact admin", content = @Content) | ||
| }) | ||
| public ResponseEntity<String> deleteCfe04Transform(@PathVariable("id") Integer id) { | ||
| @ApiResponse(responseCode = "500", description = "Internal server error, contact admin", content = @Content)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
500
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
500 swapped to 400
|
|
||
| // Assertions | ||
| assertEquals(expected, actual); | ||
| assertThat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertThat -> assertEquals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swapped.
| @Order(3) | ||
| @Order(4) | ||
| @Description("Tests that ALL cfe_04 transforms can be fetched") | ||
| public void testGetALLCfe04Transforms() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test case for empty list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test case for empty list added
| @Order(4) | ||
| @Description("Tests that ALL cfe_04 transforms can be fetched") | ||
| public void testGetALLCfe04Transforms() { | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test case for trying to get invalid id transform?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Procedure did not check if id is valid which returns empty list instead. Will correct so that error is thrown if there is no cfe_04 to fetch from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now checks if transforms record does not exists in cfe_04_transforms table with given cfe_04 id. If record is missing then error is thrown. This is tested testGetCfe04TransformsInvalidId test method.
569eaa9 to
8019ad7
Compare
More info on PR #155