IpTranslatorProcessor { protected String getEnvironmentFromSlackMessage(SlackMessage message) { Pattern envName = Pattern.compile(".*Environment: (?<env>.*?)\\n"); Matcher envMatcher = envName.matcher(message.getText()); if (! envMatcher.find()) { log.info("Failed to determine environment from slack message, aborting..."); throw new RuntimeException("Failed to determine environment!"); } return envMatcher.group("env"); }  void processMessageIfFromRateLimiter(SlackMessage message);  }
@Test public void test_that_getEnvironmentFromSlackMessage_returns_the_env_as_expected() { String env = processor.getEnvironmentFromSlackMessage(slackMessage); assertEquals("demo2", env); }