### Question:
NgramModel implements Serializable { public double logProb(String context, char c) { double res = 0; int len = context.length() + 1; String s = (len > order) ? context.substring(len - order) + c : context + c; double p = smoothProb(s); return (p > 0) ? Math.log(p) : Double.NEGATIVE_INFINITY; } NgramModel(int order);  NgramModel(File file); int size(); void save(File file); double[] getGoodTuringPars(); int occurrences(String key); void addWord(String word); void addWords(File file, Charset encoding, boolean caseSensitive); double logWordProb(String word); double logPerWordLikelihood(boolean caseSensitive); void addText(InputStream is); double logLikelihood(InputStream is, int contextLength); double logLikelihood(String context, String input); double logProb(String context, char c); @Override String toString(); void showDiff(NgramModel other); boolean equals(NgramModel other); @Override boolean equals(Object o); @Override int hashCode(); static void main(String[] args);  }### Answer:
@Test public void testLogProb() { System.out.println("logProb"); NgramModel instance = new NgramModel(1); instance.addWord("lava"); double expResult = -Math.log(5); double result = instance.logProb("baba", 'v'); assertEquals(expResult, result, 0.01); instance = new NgramModel(2); instance.addWord("lava"); expResult = Math.log(0.2); result = instance.logProb("ca", 'v'); assertEquals(expResult, result, 0.01); }