CDKToBeam { Edge toBeamEdge(IBond b, Map<IAtom, Integer> indices) throws CDKException { checkArgument(b.getAtomCount() == 2, "Invalid number of atoms on bond"); int u = indices.get(b.getBegin()); int v = indices.get(b.getEnd()); return toBeamEdgeLabel(b, this.flavour).edge(u, v); } CDKToBeam();   CDKToBeam(int flavour);   }
@SuppressWarnings("unchecked") @Test(expected = CDKException.class) public void unsetBondOrder() throws Exception { IAtom u = mock(IAtom.class); IAtom v = mock(IAtom.class); IBond b = new Bond(u, v, IBond.Order.UNSET); Map<IAtom, Integer> mock = mock(Map.class); when(mock.get(u)).thenReturn(0); when(mock.get(v)).thenReturn(1); new CDKToBeam().toBeamEdge(b, mock); }
@SuppressWarnings("unchecked") @Test(expected = CDKException.class) public void undefBondOrder() throws Exception { IAtom u = mock(IAtom.class); IAtom v = mock(IAtom.class); IBond b = new Bond(u, v, null); Map<IAtom, Integer> mock = mock(Map.class); when(mock.get(u)).thenReturn(0); when(mock.get(v)).thenReturn(1); new CDKToBeam().toBeamEdge(b, mock); }
@SuppressWarnings("unchecked") @Test(expected = IllegalArgumentException.class) public void tooFewAtoms() throws Exception { IBond b = new Bond(new IAtom[]{mock(IAtom.class)}); new CDKToBeam().toBeamEdge(b, mock(Map.class)); }
@SuppressWarnings("unchecked") @Test(expected = IllegalArgumentException.class) public void tooManyAtoms() throws Exception { IBond b = new Bond(new IAtom[]{mock(IAtom.class), mock(IAtom.class), mock(IAtom.class)}); new CDKToBeam().toBeamEdge(b, mock(Map.class)); }
@SuppressWarnings("unchecked") @Test public void singleBond() throws Exception { IAtom u = mock(IAtom.class); IAtom v = mock(IAtom.class); IBond b = new Bond(u, v); Map<IAtom, Integer> mock = mock(Map.class); when(mock.get(u)).thenReturn(0); when(mock.get(v)).thenReturn(1); CDKToBeam c2g = new CDKToBeam(); assertThat(c2g.toBeamEdge(b, mock), is(uk.ac.ebi.beam.Bond.SINGLE.edge(0, 1))); }
@SuppressWarnings("unchecked") @Test public void aromaticBond() throws Exception { IAtom u = mock(IAtom.class); IAtom v = mock(IAtom.class); IBond b = new Bond(u, v); b.setFlag(CDKConstants.ISAROMATIC, true); Map<IAtom, Integer> mock = mock(Map.class); when(mock.get(u)).thenReturn(0); when(mock.get(v)).thenReturn(1); when(u.isAromatic()).thenReturn(true); when(v.isAromatic()).thenReturn(true); CDKToBeam c2g = new CDKToBeam(); assertThat(c2g.toBeamEdge(b, mock), is(uk.ac.ebi.beam.Bond.AROMATIC.edge(0, 1))); }
@SuppressWarnings("unchecked") @Test public void doubleBond() throws Exception { IAtom u = mock(IAtom.class); IAtom v = mock(IAtom.class); IBond b = new Bond(u, v, IBond.Order.DOUBLE); Map<IAtom, Integer> mock = mock(Map.class); when(mock.get(u)).thenReturn(0); when(mock.get(v)).thenReturn(1); CDKToBeam c2g = new CDKToBeam(); assertThat(c2g.toBeamEdge(b, mock), is(uk.ac.ebi.beam.Bond.DOUBLE.edge(0, 1))); }
@SuppressWarnings("unchecked") @Test public void tripleBond() throws Exception { IAtom u = mock(IAtom.class); IAtom v = mock(IAtom.class); IBond b = new Bond(u, v, IBond.Order.TRIPLE); Map<IAtom, Integer> mock = mock(Map.class); when(mock.get(u)).thenReturn(0); when(mock.get(v)).thenReturn(1); CDKToBeam c2g = new CDKToBeam(); assertThat(c2g.toBeamEdge(b, mock), is(uk.ac.ebi.beam.Bond.TRIPLE.edge(0, 1))); }
@SuppressWarnings("unchecked") @Test public void quadrupleBond() throws Exception { IAtom u = mock(IAtom.class); IAtom v = mock(IAtom.class); IBond b = new Bond(u, v, IBond.Order.QUADRUPLE); Map<IAtom, Integer> mock = mock(Map.class); when(mock.get(u)).thenReturn(0); when(mock.get(v)).thenReturn(1); CDKToBeam c2g = new CDKToBeam(); assertThat(c2g.toBeamEdge(b, mock), is(uk.ac.ebi.beam.Bond.QUADRUPLE.edge(0, 1))); }