### Question:
MiruTermComposer { public MiruTermId compose(MiruSchema schema, MiruFieldDefinition fieldDefinition, StackBuffer stackBuffer, String... parts) throws Exception { return termInterner.intern(compose(schema, fieldDefinition, stackBuffer, parts, 0, parts.length)); } MiruTermComposer(final Charset charset, MiruInterner<MiruTermId> termInterner); MiruTermId compose(MiruSchema schema, MiruFieldDefinition fieldDefinition, StackBuffer stackBuffer, String... parts); String[] decompose(MiruSchema schema, MiruFieldDefinition fieldDefinition, StackBuffer stackBuffer, MiruTermId term); byte[] prefixLowerInclusive(MiruSchema schema, MiruFieldDefinition fieldDefinition, StackBuffer stackBuffer, String... parts); byte[] prefixUpperExclusive(MiruSchema schema, MiruFieldDefinition fieldDefinition, StackBuffer stackBuffer, String... parts); byte[] prefixUpperExclusiveBytes(Prefix p, String pre); static void makeUpperExclusive(byte[] raw);  }### Answer:
@Test public void testCompose() throws Exception { MiruTermComposer termComposer = new MiruTermComposer(StandardCharsets.UTF_8, new MiruInterner<MiruTermId>(true) { @Override public MiruTermId create(byte[] bytes) { return new MiruTermId(bytes); } }); MiruFieldDefinition.Prefix TYPED_PREFIX = new MiruFieldDefinition.Prefix(MiruFieldDefinition.Prefix.Type.numeric, 4, ' '); MiruSchema SCHEMA = new MiruSchema.Builder("test", 1) .setFieldDefinitions(new MiruFieldDefinition[] { new MiruFieldDefinition(0, "context", singleTerm, TYPED_PREFIX), new MiruFieldDefinition(1, "parent", singleTerm, TYPED_PREFIX), new MiruFieldDefinition(2, "contextParent", singleTerm, MiruFieldDefinition.Prefix.WILDCARD) }) .setComposite(ImmutableMap.of("contextParent", new String[] { "context", "parent" })) .build(); Random r = new Random(); for (int i = 0; i < 100; i++) { int type1 = r.nextInt(2); long id1 = Math.abs(r.nextLong() % 10); int type2 = r.nextInt(2); long id2 = Math.abs(r.nextLong() % 10); String[] partsIn = { type1 + " " + id1, type2 + " " + id2 }; MiruTermId composed = termComposer.compose(SCHEMA, SCHEMA.getFieldDefinition(2), new StackBuffer(), partsIn); String[] partsOut = termComposer.decompose(SCHEMA, SCHEMA.getFieldDefinition(2), new StackBuffer(), composed); Assert.assertTrue(Arrays.equals(partsIn, partsOut)); } }