### Question:
VariantAlternateRearranger { private <T> List<T> rearrange(List<T> originalValues, T missingValue, boolean includeReference, int[] map) { List<T> rearrangedValues = new ArrayList<>(includeReference ? this.map.length + 1 : this.map.length); rearrange(originalValues, missingValue, rearrangedValues::add, includeReference, map); return rearrangedValues; } <T> VariantAlternateRearranger(List<T> originalAlternates, List<T> reorderedAlternates); <T> VariantAlternateRearranger(List<T> originalAlternates, List<T> reorderedAlternates,
                                          Configuration configuration); Genotype rearrangeGenotype(String genotypeString, String reference, List<String> alternateAlleles); Genotype rearrangeGenotype(Genotype genotype); String rearrangeNumberR(String data); String rearrangeNumberR(String data, String missingValue); List<T> rearrangeNumberR(List<T> values, T missingValue); String rearrangeNumberA(String data); String rearrangeNumberA(String data, String missingValue); List<T> rearrangeNumberA(List<T> values, T missingValue); String rearrangeNumberG(String data, String missingValue, @Nullable Integer ploidy); List<T> rearrangeNumberG(List<T> values, T missingValue, @Nullable Integer ploidy); static List<String> getOrdering(int p, int n, int[] map); static void getOrdering(int p, int n, List<String> list, int[] gt, int pos, int[] map); String rearrange(String key, String data); String rearrange(String key, String data, @Nullable Integer ploidy); static final int DEFAULT_PLOIDY; }### Answer:
@Test public void testRearrange() { VariantAlternateRearranger r = new VariantAlternateRearranger(Arrays.asList("A", "B", "C"), Arrays.asList("C", "A", "B")); assertEquals(".,A,.", r.rearrangeNumberA("A")); assertEquals(".,A,B", r.rearrangeNumberA("A,B")); assertEquals("C,A,B", r.rearrangeNumberA("A,B,C")); assertEquals("R,.,A,.", r.rearrangeNumberR("R,A")); assertEquals("R,.,A,B", r.rearrangeNumberR("R,A,B")); assertEquals("R,C,A,B", r.rearrangeNumberR("R,A,B,C")); r = new VariantAlternateRearranger(Arrays.asList("A", "B", "C"), Arrays.asList("B", "A", "C")); assertEquals(".,A,.", r.rearrangeNumberA("A")); assertEquals("B,A,.", r.rearrangeNumberA("A,B")); assertEquals("B,A,C", r.rearrangeNumberA("A,B,C")); assertEquals("R,.,A,.", r.rearrangeNumberR("R,A")); assertEquals("R,B,A,.", r.rearrangeNumberR("R,A,B")); assertEquals("R,B,A,C", r.rearrangeNumberR("R,A,B,C")); }