src/test/java/com/redhat/MessageHelperTest.java
/**
     * Test behavior when the user deletes all the explanations from an acronym. Such acronym is not deleted from the DB,
     * but should be capable of acting as a regular acronym, e.g. it should accept new explanations upon adding, and
     * it should not return any results when it contains no explanations.
     */
Test behavior when the user deletes all the explanations from an acronym. Such acronym is not deleted from the DB,
but should be capable of acting as a regular acronym, e.g. it should accept new explanations upon adding, and
it should not return any results when it contains no explanations.
Test behavior when the user deletes all the explanations from an acronym . Such acronym is not deleted from the DB but should be capable of acting as a regular acronym e . g . it should accept new explanations upon adding and it should not return any results when it contains no explanations .
@Test
    public void removeAllExplanationAndReAddTest() {
        JsonNode removeExplanation = JsonNodeHelper.alterArgumentText("!" + JsonNodeHelper.INITIAL_ACRONYM +
                "=" + JsonNodeHelper.EXPLANATION + "=>");
        helper.handleMessageAction(removeExplanation);
        Assertions
                .assertThat(helper.handleMessageAction(removeExplanation))
                .as("Removing explanation from an already empty explanation set failed")
                .isEqualTo(Constants.EXPLANATION_NOT_FOUND);
        Assertions
                .assertThat(helper.handleMessageAction(JsonNodeHelper.getInitialAcronymLowercase()))
                .as("An acronym with an empty explanation set should be evaluated as not found")
                .isEqualTo(Constants.ACRONYM_NOT_FOUND);
        helper.handleMessageAction(JsonNodeHelper.updateInitialAcronym());
        Assertions
                .assertThat(helper.handleMessageAction(JsonNodeHelper.getInitialAcronymLowercase()))
                .as("Re-initializing explanations for an acronym with originally empty explanation set failed")
                .isEqualTo(JsonNodeHelper.EXPLANATION_UPDATE + "\n");
    }
@ Test public void removeAllExplanationAndReAddTest ( ) { JsonNode removeExplanation = JsonNodeHelper . alterArgumentText ( "!" + JsonNodeHelper . INITIAL_ACRONYM + "=" + JsonNodeHelper . EXPLANATION + "=>" ) ; helper . handleMessageAction ( removeExplanation ) ; Assertions . assertThat ( helper . handleMessageAction ( removeExplanation ) ) . as ( "Removing explanation from an already empty explanation set failed" ) . isEqualTo ( Constants . EXPLANATION_NOT_FOUND ) ; Assertions . assertThat ( helper . handleMessageAction ( JsonNodeHelper . getInitialAcronymLowercase ( ) ) ) . as ( "An acronym with an empty explanation set should be evaluated as not found" ) . isEqualTo ( Constants . ACRONYM_NOT_FOUND ) ; helper . handleMessageAction ( JsonNodeHelper . updateInitialAcronym ( ) ) ; Assertions . assertThat ( helper . handleMessageAction ( JsonNodeHelper . getInitialAcronymLowercase ( ) ) ) . as ( "Re-initializing explanations for an acronym with originally empty explanation set failed" ) . isEqualTo ( JsonNodeHelper . EXPLANATION_UPDATE + "\n" ) ; }
Test behavior when the user deletes all the explanations from an acronym.
Test behavior when the user deletes all the explanations from an acronym .
// Removing explanation is already tested // Updating original acronym with a new explanation