SmallestRingAtom extends SMARTSAtom { @Override public boolean matches(IAtom atom) { return ringSize < 0 ? invariants(atom).ringConnectivity() > 0 : invariants(atom).ringSize().contains(ringSize); } SmallestRingAtom(int ringSize, IChemObjectBuilder builder); @Override boolean matches(IAtom atom);  }
@Test public void matches() { SmallestRingAtom matcher = new SmallestRingAtom(5, mock(IChemObjectBuilder.class)); IAtom atom = mock(IAtom.class); when(atom.getProperty(SMARTSAtomInvariants.KEY)).thenReturn( new SMARTSAtomInvariants(mock(IAtomContainer.class), 0, 0, Collections.<Integer> singleton(5), 0, 0, 0, 0)); assertTrue(matcher.matches(atom)); }