DestinationHelper { public static String resolveProduceDestination(String configured, ProduceDestination legacy, AdaptrisMessage msg) throws ProduceException { try { if (legacy != null) { return legacy.getDestination(msg); } } catch (Exception e) { throw ExceptionHelper.wrapProduceException(e); } return msg.resolve(configured); }  static void mustHaveEither(String configured, ConsumeDestination legacy); static void mustHaveEither(String configured, ProduceDestination legacy); static String consumeDestination(final String configured,
      final ConsumeDestination legacy); static String filterExpression(final String configured,
      final ConsumeDestination legacy); static String threadName(final AdaptrisMessageListener listener, final ConsumeDestination legacy); static String threadName(final AdaptrisMessageListener listener,
      final ConsumeDestination legacy, String defaultName); static String resolveProduceDestination(String configured, ProduceDestination legacy,
      AdaptrisMessage msg); @Deprecated static void logConsumeDestinationWarning(boolean alreadyLogged,
      WarningLoggedCallback callback,
      ConsumeDestination d, String text,
      Object... args); static void logWarningIfNotNull(boolean alreadyLogged,
      WarningLoggedCallback callback, Object d, String text, Object... args);  }
@Test public void testProduceDestination() throws Exception { AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(); ConfiguredProduceDestination dest = new ConfiguredProduceDestination("dest"); assertNull(resolveProduceDestination(null, null, msg)); assertEquals("x", resolveProduceDestination("x", null, msg)); assertEquals("dest", resolveProduceDestination(null, dest, msg)); assertEquals("dest", resolveProduceDestination("x", dest, msg)); }
@Test(expected = ProduceException.class) public void testProduceDestination_WithException() throws Exception { AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(); resolveProduceDestination(null, (m) -> { throw new CoreException(); }, msg); }