Skip to content

Conversation

@Nefarious46
Copy link
Contributor

  • Void on delete
  • Procedures named accordingly
  • Controllers named accordingly
  • TestData inserted before unit tests.

More info on PR #155

@Nefarious46 Nefarious46 requested a review from kortemik May 21, 2025 07:54
@Nefarious46 Nefarious46 self-assigned this May 21, 2025
@Nefarious46 Nefarious46 added the enhancement New feature or request label May 21, 2025
@Nefarious46 Nefarious46 force-pushed the Cfe04TransformEndpointRefactor branch from 7cdbc64 to 569eaa9 Compare May 26, 2025 07:26
String state = error + "-" + ((SQLException) cause).getSQLState();
JSONObject jsonErr = new JSONObject();
jsonErr.put("id", newCfe04Transform.getId());
if (state.equals("1452-23000")) {
Copy link
Collaborator

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

Copy link
Contributor Author

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)})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

500 not necessary?

Copy link
Contributor Author

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

500

Copy link
Contributor Author

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)})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

500

Copy link
Contributor Author

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(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertThat -> assertEquals

Copy link
Contributor Author

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() {
Copy link
Collaborator

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?

Copy link
Contributor Author

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() {

Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@Nefarious46 Nefarious46 force-pushed the Cfe04TransformEndpointRefactor branch from 569eaa9 to 8019ad7 Compare June 24, 2025 14:31
@Nefarious46 Nefarious46 requested a review from eemhu June 24, 2025 14:31
@q22u q22u removed the review label Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants