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