GeometricCumulativeDoubleBondFactory implements StereoEncoderFactory { static int elevation(IBond bond, IAtom a) { return bond.getBegin().equals(a) ? elevation(bond) : elevation(bond) * -1; }  @Override StereoEncoder create(IAtomContainer container, int[][] graph);  }
@Test public void testElevation_Atom_Up() throws Exception { IAtom a1 = mock(IAtom.class); IAtom a2 = mock(IAtom.class); IBond bond = mock(IBond.class); when(bond.getStereo()).thenReturn(IBond.Stereo.UP); when(bond.getBegin()).thenReturn(a1); when(bond.getEnd()).thenReturn(a2); assertThat(GeometricCumulativeDoubleBondFactory.elevation(bond, a1), is(+1)); assertThat(GeometricCumulativeDoubleBondFactory.elevation(bond, a2), is(-1)); }
@Test public void testElevation_Atom_Down() throws Exception { IAtom a1 = mock(IAtom.class); IAtom a2 = mock(IAtom.class); IBond bond = mock(IBond.class); when(bond.getStereo()).thenReturn(IBond.Stereo.DOWN); when(bond.getBegin()).thenReturn(a1); when(bond.getEnd()).thenReturn(a2); assertThat(GeometricCumulativeDoubleBondFactory.elevation(bond, a1), is(-1)); assertThat(GeometricCumulativeDoubleBondFactory.elevation(bond, a2), is(+1)); }
@Test public void testElevation_null() throws Exception { IBond bond = mock(IBond.class); assertThat(GeometricCumulativeDoubleBondFactory.elevation(bond), is(0)); }
@Test public void testElevation_Up() throws Exception { IBond bond = mock(IBond.class); when(bond.getStereo()).thenReturn(IBond.Stereo.UP); assertThat(GeometricCumulativeDoubleBondFactory.elevation(bond), is(+1)); }
@Test public void testElevation_Down() throws Exception { IBond bond = mock(IBond.class); when(bond.getStereo()).thenReturn(IBond.Stereo.DOWN); assertThat(GeometricCumulativeDoubleBondFactory.elevation(bond), is(-1)); }