FileDocCategorySizeDatePackage
MockTableModelListener.javaAPI DocExample2350Thu Jun 27 19:20:24 BST 2002com.oreilly.mock

MockTableModelListener

public class MockTableModelListener extends Object implements TableModelListener

Fields Summary
private List
events
private List
expectedEvents
private int
expectedEventCount
Constructors Summary
Methods Summary
public voidaddExpectedEvent(javax.swing.event.TableModelEvent e)


        
        if (this.expectedEvents == null) {
            this.expectedEvents = new ArrayList();
        }
        this.expectedEvents.add(new ComparableTableModelEvent(e));
    
public intgetEventCount()

        return this.events.size();
    
public java.util.ListgetEvents()

        return this.events;
    
public voidsetExpectedEventCount(int n)

        this.expectedEventCount = n;
    
public voidtableChanged(javax.swing.event.TableModelEvent e)

        this.events.add(e);
        if (this.expectedEventCount > -1
                && this.events.size() > this.expectedEventCount) {
            Assert.fail("Exceeded the expected event count: "
                    + this.expectedEventCount);
        }
    
public voidverify()

        if (this.expectedEventCount > -1) {
            Assert.assertEquals("Expected event count",
                    this.expectedEventCount,
                    this.events.size());
        }

        if (this.expectedEvents != null) {
            Assert.assertEquals("Expected events",
                    this.expectedEvents,
                    this.events);
        }