TotalRingConnectionAtom extends SMARTSAtom { @Override public boolean matches(IAtom atom) { return invariants(atom).ringConnectivity() == ringConnectivity; } TotalRingConnectionAtom(int ringConnectivity, IChemObjectBuilder builder); @Override boolean matches(IAtom atom);  }
@Test public void matches() throws Exception { TotalRingConnectionAtom matcher = new TotalRingConnectionAtom(2, mock(IChemObjectBuilder.class)); IAtom atom = mock(IAtom.class); when(atom.getProperty(SMARTSAtomInvariants.KEY)) .thenReturn( new SMARTSAtomInvariants(mock(IAtomContainer.class), 0, 0, Collections.<Integer> emptySet(), 2, 0, 0, 0)); assertTrue(matcher.matches(atom)); }