JsTopicInterceptor implements Serializable { String computeTopic(JsTopicName jsTopicName, String topic) { StringBuilder result = new StringBuilder(); if (!jsTopicName.prefix().isEmpty()) { result.append(jsTopicName.prefix()).append(Constants.Topic.COLON); } result.append(topic); if (!jsTopicName.postfix().isEmpty()) { result.append(Constants.Topic.COLON).append(jsTopicName.postfix()); } return result.toString(); }  @AroundInvoke Object processJsTopic(InvocationContext ctx);  }
@Test public void testComputeTopic() { System.out.println("computeTopic"); String topic = "TOPIC"; JsTopicName jsTopicName = new JsTopicNameImpl("", ""); String result = instance.computeTopic(jsTopicName, topic); assertThat(result).isEqualTo("TOPIC"); jsTopicName = new JsTopicNameImpl("PREFIX", ""); result = instance.computeTopic(jsTopicName, topic); assertThat(result).isEqualTo("PREFIX:TOPIC"); jsTopicName = new JsTopicNameImpl("", "POSTFIX"); result = instance.computeTopic(jsTopicName, topic); assertThat(result).isEqualTo("TOPIC:POSTFIX"); jsTopicName = new JsTopicNameImpl("PREFIX", "POSTFIX"); result = instance.computeTopic(jsTopicName, topic); assertThat(result).isEqualTo("PREFIX:TOPIC:POSTFIX"); }