FileDocCategorySizeDatePackage
TestUpdatingList.javaAPI DocApache Lucene 2.0.02657Fri May 26 09:53:46 BST 2006org.apache.lucene.swing.models

TestUpdatingList

public class TestUpdatingList extends TestCase
author
Jonathan Simon - jonathan_s_simon@yahoo.com

Fields Summary
private BaseListModel
baseListModel
private ListSearcher
listSearcher
RestaurantInfo
infoToAdd1
RestaurantInfo
infoToAdd2
Constructors Summary
Methods Summary
protected voidsetUp()

        baseListModel = new BaseListModel(DataStore.getRestaurants());
        listSearcher = new ListSearcher(baseListModel);

        infoToAdd1 = new RestaurantInfo();
        infoToAdd1.setName("Pino's");

        infoToAdd2 = new RestaurantInfo();
        infoToAdd2.setName("Pino's");
        infoToAdd2.setType("Italian");
    
public voidtestAddWithSearch()

        assertEquals(baseListModel.getSize(), listSearcher.getSize());
        listSearcher.search("pino's");
        int count = listSearcher.getSize();
        baseListModel.addRow(infoToAdd2);
        count++;
        assertEquals(count, listSearcher.getSize());
    
public voidtestAddWithoutSearch()

        assertEquals(baseListModel.getSize(), listSearcher.getSize());
        int count = listSearcher.getSize();
        baseListModel.addRow(infoToAdd1);
        count++;
        assertEquals(count, listSearcher.getSize());
    
public voidtestRemoveWithSearch()

        assertEquals(baseListModel.getSize(), listSearcher.getSize());
        baseListModel.addRow(infoToAdd1);
        listSearcher.search("pino's");
        int count = listSearcher.getSize();
        baseListModel.removeRow(infoToAdd1);
        count--;
        assertEquals(count, listSearcher.getSize());
    
public voidtestRemoveWithoutSearch()

        assertEquals(baseListModel.getSize(), listSearcher.getSize());
        baseListModel.addRow(infoToAdd1);
        int count = listSearcher.getSize();
        baseListModel.removeRow(infoToAdd1);
        count--;
        assertEquals(count, listSearcher.getSize());