ConfigurationManager cm = new ConfigurationManager(configURL);
setProperty(cm, "trigramModel", "location", lm.toString());
Recognizer recognizer = cm.lookup("recognizer");
StreamDataSource dataSource = cm.lookup(StreamDataSource.class);
AudioInputStream ais = getAudioInputStream(audioFileURL);
dataSource.setInputStream(ais);
recognizer.allocate();
Lattice lattice = new Lattice(recognizer.recognize());
cm = new ConfigurationManager(configURL);
setProperty(cm, "keepAllTokens", "true");
setProperty(cm, "trigramModel", "location", lm.toString());
recognizer = cm.lookup("recognizer");
recognizer.allocate();
dataSource = cm.lookup(StreamDataSource.class);
dataSource.setInputStream(getAudioInputStream(audioFileURL));
Lattice allLattice = new Lattice(recognizer.recognize());
assertTrue(lattice.isEquivalent(allLattice));
}