| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Jazzy example source code file (

This example Jazzy source code file ( is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Jazzy tags/keywords

exception, no, string, string, testcase, texwordfinder, texwordfinder, texwordfindertester, this, this, word, word

The Jazzy source code

Jazzy - a Java library for Spell Checking
Copyright (C) 2001 Mindaugas Idzelis
Full text of license can be found in LICENSE.txt

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

package com.swabunga.test.spell.event;

import junit.framework.*;
import junit.textui.*;
import com.swabunga.spell.event.*;

public class TeXWordFinderTester extends TestCase {

  public TeXWordFinderTester(String name){
  protected void setUp(){
  protected void tearDown(){
  public void testWordFindA(){
    assertFound("string of words","string");
  public void testWordFindB(){
    assertFound("\\string of words","of");
  public void testWordFindC(){
    assertFound("\\begin{testing}\nthe text \n\\end{testing}","the");
  public void testWordFindD(){
  public void testWordFindE(){
  public void testWordFindF(){
  public void testUnaryWordFindA(){
    assertFound("a test of words","a");
  public void testUnaryWordFindB(){
    assertFound("\\string a test","a");
  public void testUnaryWordFindC(){
    assertFound("\\begin{testing}\na test \n\\end{testing}","a");
  public void testUnaryWordFindD(){
  public void testUnaryWordFindE(){
    assertFound("%testing\na time","a");
  public void testUnaryWordFindF(){
    assertFound("$testing$a time","a");
  public void testUnaryWordFindG(){
    assertFound("$$testing$$a time","a");
  public void testUnaryWordFindH(){
    assertFound("\\newcommand{not these}\\newcommand{not these}a time","a");

  public void testNoWordsFoundA(){
  public void testNoWordsFoundB(){
    assertNotFound("\\string  \\of\\words");
  public void testNoWordsFoundC(){
  public void testNoWordsFoundD(){
    assertNotFound("%testing time");    
  public void testNoWordsFoundE(){
    assertNotFound("$testing time$");    
  public void testNoWordsFoundF(){
    assertNotFound("$$testing time$$");    
  public void testFindAllWordsA(){
    String[] expected = {"This","is","a","simple","test","string"};
    assertAllWordsFound("This is a simple test string.", expected);
  public void testFindAllWordsB(){
    String[] expected = {"is","a","test"};
    assertAllWordsFound("\\This is a \\simple test \\string.", expected);
  public void testFindAllWordsC(){
    String[] expected = {"This","is","a","simple","test","string"};
    assertAllWordsFound("This is a simple test string.", expected);
  public void testFindAllWordsD(){
    String[] expected = {"This","is","a","simple","test","string"};
    assertAllWordsFound("This is a simple test string.", expected);
  private void assertAllWordsFound(String text, String[] expected){
    TeXWordFinder finder = new TeXWordFinder(text);
    Word found;
    int wordCount = 0;
      for (int i = 0; i < expected.length; i++){
        found =;
      found =;
      fail("No more words should have been found\nString: '" + found + "'");
    }catch(Exception e){
      assertEquals(expected.length, wordCount);

  private void assertNotFound(String testText){
    TeXWordFinder finder = new TeXWordFinder(testText);
      fail("\nNo words should have been found!\nWordNotFoundException should have been thrown.\nString: " + testText);
    }catch (Exception e){
  private void assertFound(String testText, String expected){
    TeXWordFinder finder = new TeXWordFinder(testText);
    Word found =;
  public static void main(String[] args){ TestSuite(TeXWordFinderTester.class));

Other Jazzy examples (source code examples)

Here is a short list of links related to this Jazzy source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.