MessagingUtils { public static String buildId( RecipientKind ownerKind, String domain, String applicationName, String scopedInstancePath ) { StringBuilder sb = new StringBuilder(); sb.append( "[ " ); sb.append( domain ); sb.append( " ] " ); if( ownerKind == RecipientKind.DM ) { sb.append( "DM" ); } else { sb.append( scopedInstancePath ); sb.append( " @ " ); sb.append( applicationName ); } return sb.toString(); } private  MessagingUtils(); static String buildTopicNameForAgent( Instance instance ); static String buildTopicNameForAgent( String scopedInstancePath ); static String escapeInstancePath( String instancePath ); static String buildId(
			RecipientKind ownerKind,
			String domain,
			String applicationName,
			String scopedInstancePath );  }
@Test public void testBuildId() { String id = MessagingUtils.buildId( RecipientKind.DM, "domain", "app", "/root" ); Assert.assertEquals( "[ domain ] DM", id ); id = MessagingUtils.buildId( RecipientKind.AGENTS, "domain", "app", "/root" ); Assert.assertEquals( "[ domain ] /root @ app", id ); id = MessagingUtils.buildId( RecipientKind.INTER_APP, "domain", "app", "/root" ); Assert.assertEquals( "[ domain ] /root @ app", id ); }