Class SlackAppenderTest

java.lang.Object
ubic.gemma.core.logging.SlackAppenderTest

@ExtendWith(org.mockito.junit.jupiter.MockitoExtension.class) public class SlackAppenderTest extends Object
  • Constructor Details

    • SlackAppenderTest

      public SlackAppenderTest()
  • Method Details

    • setUp

      @BeforeEach public void setUp()
    • test

      @Test public void test() throws Exception
      Throws:
      Exception
    • testWithStacktrace

      @Test public void testWithStacktrace() throws com.slack.api.methods.SlackApiException, IOException
      Throws:
      com.slack.api.methods.SlackApiException
      IOException
    • testWhenSlackApiRaisesException

      @Test public void testWhenSlackApiRaisesException() throws com.slack.api.methods.SlackApiException, IOException
      Throws:
      com.slack.api.methods.SlackApiException
      IOException
    • testWhenSlackFailsToClose

      @Test public void testWhenSlackFailsToClose() throws Exception
      Throws:
      Exception
    • testWithContextData

      @Test public void testWithContextData() throws com.slack.api.methods.SlackApiException, IOException
      Throws:
      com.slack.api.methods.SlackApiException
      IOException
    • testWithContextStack

      @Test public void testWithContextStack() throws com.slack.api.methods.SlackApiException, IOException
      Throws:
      com.slack.api.methods.SlackApiException
      IOException
    • testAnUnresolvedTokenPostsNothing

      @Test public void testAnUnresolvedTokenPostsNothing()
      🛑 An unresolved placeholder is not a token, and posting with it is worse than not posting.

      A deployment that never set gemma.slack.token hands the appender the literal ${gemma.slack.token}. Every ERROR then produced three lines: the error itself, the SDK's missing-text warning, and auth.test API (error: invalid_auth) from the failed post — and since the appender is bound to ERROR, a run that logs a thousand errors makes three thousand lines and a thousand pointless requests to Slack.

    • testABlankTokenPostsNothing

      @Test public void testABlankTokenPostsNothing()
      Same for a deployment that set the property to nothing at all.
    • testThePostCarriesATextFallback

      @Test public void testThePostCarriesATextFallback() throws IOException, com.slack.api.methods.SlackApiException
      The fallback Slack renders where blocks cannot be — notifications, screen readers. Without it the SDK warns on every post, which is a warning per error on a configured deployment.
      Throws:
      IOException
      com.slack.api.methods.SlackApiException