ConsumerConstructorInterceptor implements InstanceConstructorInterceptor { @Override public void onConstruct(EnhancedInstance objInst, Object[] allArguments) { ConsumerConfig config = (ConsumerConfig) allArguments[0]; ConsumerEnhanceRequiredInfo requiredInfo = new ConsumerEnhanceRequiredInfo(); requiredInfo.setBrokerServers(config.getList("bootstrap.servers")); requiredInfo.setGroupId(config.getString("group.id")); objInst.setSkyWalkingDynamicField(requiredInfo); }  @Override void onConstruct(EnhancedInstance objInst, Object[] allArguments);  }
@Test public void testOnConsumer() { constructorInterceptor.onConstruct(enhancedInstance, new Object[] {consumerConfig}); ConsumerEnhanceRequiredInfo consumerEnhanceRequiredInfo = (ConsumerEnhanceRequiredInfo) enhancedInstance.getSkyWalkingDynamicField(); assertThat(consumerEnhanceRequiredInfo.getBrokerServers(), is("localhost:9092;localhost:19092")); }