HashGeneratorMaker { public HashGeneratorMaker encode(AtomEncoder encoder) { if (encoder == null) throw new NullPointerException("no encoder provided"); customEncoders.add(encoder); return this; }  HashGeneratorMaker depth(int depth); HashGeneratorMaker elemental(); HashGeneratorMaker isotopic(); HashGeneratorMaker charged(); HashGeneratorMaker orbital(); HashGeneratorMaker radical(); HashGeneratorMaker chiral(); HashGeneratorMaker suppressHydrogens(); HashGeneratorMaker perturbed(); HashGeneratorMaker encode(AtomEncoder encoder); EnsembleHashGenerator ensemble(); MoleculeHashGenerator molecular(); AtomHashGenerator atomic();  }
@Test(expected = NullPointerException.class) public void testEncode_Null() { new HashGeneratorMaker().encode(null); }
@Test public void testEncode() { AtomEncoder e1 = mock(AtomEncoder.class); AtomEncoder e2 = mock(AtomEncoder.class); AtomHashGenerator generator = new HashGeneratorMaker().depth(0).encode(e1).encode(e2).atomic(); List<AtomEncoder> encoders = getEncoders((BasicAtomHashGenerator) generator); assertThat(encoders.size(), is(2)); assertThat(encoders.get(0), is(e1)); assertThat(encoders.get(1), is(e2)); generator = new HashGeneratorMaker().depth(0).encode(e2).encode(e1).atomic(); encoders = getEncoders((BasicAtomHashGenerator) generator); assertThat(encoders.size(), is(2)); assertThat(encoders.get(0), is(e2)); assertThat(encoders.get(1), is(e1)); }