LengthPrefixUnknownCoders { public static String addLengthPrefixedCoder( String coderId, RunnerApi.Components.Builder components, boolean replaceWithByteArrayCoder) { String lengthPrefixedByteArrayCoderId = addLengthPrefixByteArrayCoder(components); String urn = components.getCodersOrThrow(coderId).getSpec().getUrn(); if (ModelCoders.LENGTH_PREFIX_CODER_URN.equals(urn)) { return replaceWithByteArrayCoder ? lengthPrefixedByteArrayCoderId : coderId; } else if (ModelCoders.urns().contains(urn)) { return addForModelCoder(coderId, components, replaceWithByteArrayCoder); } else { return replaceWithByteArrayCoder ? lengthPrefixedByteArrayCoderId : addWrappedWithLengthPrefixCoder(coderId, components); } }  static String addLengthPrefixedCoder(
      String coderId, RunnerApi.Components.Builder components, boolean replaceWithByteArrayCoder);  }
@Test public void test() throws IOException { SdkComponents sdkComponents = SdkComponents.create(); sdkComponents.registerEnvironment(Environments.createDockerEnvironment("java")); String coderId = sdkComponents.registerCoder(original); Components.Builder components = sdkComponents.toComponents().toBuilder(); String updatedCoderId = LengthPrefixUnknownCoders.addLengthPrefixedCoder(coderId, components, replaceWithByteArray); assertEquals( expected, RehydratedComponents.forComponents(components.build()).getCoder(updatedCoderId)); }