GeometricDoubleBondEncoderFactory implements StereoEncoderFactory { static PermutationParity permutation(int[] neighbors) { return neighbors.length == 2 ? PermutationParity.IDENTITY : new BasicPermutationParity(Arrays.copyOf(neighbors, neighbors.length - 1)); }  @Override StereoEncoder create(IAtomContainer container, int[][] graph);  }
@Test public void testPermutation_SingleSubstituents() throws Exception { assertThat(permutation(new int[]{1, 2}), is(PermutationParity.IDENTITY)); }
@Test public void testPermutation_TwoSubstituents() throws Exception { PermutationParity p = permutation(new int[]{1, 2, 0}); assertTrue(p instanceof BasicPermutationParity); Field field = p.getClass().getDeclaredField("indices"); field.setAccessible(true); assertArrayEquals((int[]) field.get(p), new int[]{1, 2}); }