src/test/java/com/redhat/MessageHelperTest.java
/**
     * Test whether update and delete fails when user tries to modify someone else's acronym
     */
Test whether update and delete fails when user tries to modify someone else's acronym
Test whether update and delete fails when user tries to modify someone else ' s acronym
@Test
    public void updateDeleteFailTest() {
        Assertions
                .assertThat(helper.handleMessageAction(JsonNodeHelper.getUpdateAcronymExplanationDifferentUser()))
                .as("Updating acronym with different email address did not fail properly")
                .isEqualTo(Constants.INSUFFICIENT_PRIVILEGES);
        Assertions
                .assertThat(helper.handleMessageAction(JsonNodeHelper.getInitialAcronymLowercase()))
                .as("Even though we returned insufficient privileges, the update was persisted")
                .contains(JsonNodeHelper.EXPLANATION);
        Assertions
                .assertThat(helper.handleMessageAction(JsonNodeHelper.getDeleteAcronymInitialExplanationDifferentUser()))
                .as("Deleting acronym with different email address did not fail properly")
                .isEqualTo(Constants.INSUFFICIENT_PRIVILEGES);
        Assertions
                .assertThat(helper.handleMessageAction(JsonNodeHelper.getInitialAcronymLowercase()))
                .as("Even though we returned insufficient privileges, the delete was persisted")
                .contains(JsonNodeHelper.EXPLANATION);
    }
@ Test public void updateDeleteFailTest ( ) { Assertions . assertThat ( helper . handleMessageAction ( JsonNodeHelper . getUpdateAcronymExplanationDifferentUser ( ) ) ) . as ( "Updating acronym with different email address did not fail properly" ) . isEqualTo ( Constants . INSUFFICIENT_PRIVILEGES ) ; Assertions . assertThat ( helper . handleMessageAction ( JsonNodeHelper . getInitialAcronymLowercase ( ) ) ) . as ( "Even though we returned insufficient privileges, the update was persisted" ) . contains ( JsonNodeHelper . EXPLANATION ) ; Assertions . assertThat ( helper . handleMessageAction ( JsonNodeHelper . getDeleteAcronymInitialExplanationDifferentUser ( ) ) ) . as ( "Deleting acronym with different email address did not fail properly" ) . isEqualTo ( Constants . INSUFFICIENT_PRIVILEGES ) ; Assertions . assertThat ( helper . handleMessageAction ( JsonNodeHelper . getInitialAcronymLowercase ( ) ) ) . as ( "Even though we returned insufficient privileges, the delete was persisted" ) . contains ( JsonNodeHelper . EXPLANATION ) ; }
Test whether update and delete fails when user tries to modify someone else's acronym
Test whether update and delete fails when user tries to modify someone else ' s acronym