@Test(expected = IllegalArgumentException.class) public void testAdd_ArgumentValidation2() { LCSubstringSolver solver = new LCSubstringSolver(new DefaultCharSequenceNodeFactory()); solver.add(null); }
public boolean add(CharSequence document) { if (document == null) { throw new IllegalArgumentException("The document argument was null"); } if (document.length() == 0) { throw new IllegalArgumentException("The document argument was zero-length"); } suffixTree.acquireWriteLock(); try { String documentString = CharSequences.toString(document); boolean addedNew = originalDocuments.add(documentString); if (!addedNew) { return false; } addSuffixesToRadixTree(documentString); return true; } finally { suffixTree.releaseWriteLock(); } }
LCSubstringSolver { public boolean add(CharSequence document) { if (document == null) { throw new IllegalArgumentException("The document argument was null"); } if (document.length() == 0) { throw new IllegalArgumentException("The document argument was zero-length"); } suffixTree.acquireWriteLock(); try { String documentString = CharSequences.toString(document); boolean addedNew = originalDocuments.add(documentString); if (!addedNew) { return false; } addSuffixesToRadixTree(documentString); return true; } finally { suffixTree.releaseWriteLock(); } } }
LCSubstringSolver { public boolean add(CharSequence document) { if (document == null) { throw new IllegalArgumentException("The document argument was null"); } if (document.length() == 0) { throw new IllegalArgumentException("The document argument was zero-length"); } suffixTree.acquireWriteLock(); try { String documentString = CharSequences.toString(document); boolean addedNew = originalDocuments.add(documentString); if (!addedNew) { return false; } addSuffixesToRadixTree(documentString); return true; } finally { suffixTree.releaseWriteLock(); } } LCSubstringSolver(NodeFactory nodeFactory); }
LCSubstringSolver { public boolean add(CharSequence document) { if (document == null) { throw new IllegalArgumentException("The document argument was null"); } if (document.length() == 0) { throw new IllegalArgumentException("The document argument was zero-length"); } suffixTree.acquireWriteLock(); try { String documentString = CharSequences.toString(document); boolean addedNew = originalDocuments.add(documentString); if (!addedNew) { return false; } addSuffixesToRadixTree(documentString); return true; } finally { suffixTree.releaseWriteLock(); } } LCSubstringSolver(NodeFactory nodeFactory); boolean add(CharSequence document); CharSequence getLongestCommonSubstring(); }
LCSubstringSolver { public boolean add(CharSequence document) { if (document == null) { throw new IllegalArgumentException("The document argument was null"); } if (document.length() == 0) { throw new IllegalArgumentException("The document argument was zero-length"); } suffixTree.acquireWriteLock(); try { String documentString = CharSequences.toString(document); boolean addedNew = originalDocuments.add(documentString); if (!addedNew) { return false; } addSuffixesToRadixTree(documentString); return true; } finally { suffixTree.releaseWriteLock(); } } LCSubstringSolver(NodeFactory nodeFactory); boolean add(CharSequence document); CharSequence getLongestCommonSubstring();  }