import junit.framework.TestCase;

/**
 * A JUnit test case class.
 * Every method starting with the word "test" will be called when running
 * the test with JUnit.
 */
public class ChapterTester extends TestCase {
    
    /** Test constructor and getter methods*/
    public void testConstructor() {
        Chapter c1;
        c1= new Chapter("one", 1, null);
        Chapter c2= new Chapter("two", 2, c1);
        assertEquals("one", c1.getTitle());
        assertEquals(1, c1.getNumber());
        assertEquals(null, c1.getPrevious());
        assertEquals("two", c2.getTitle());
        assertEquals(2, c2.getNumber());
        assertEquals(c1, c2.getPrevious());
        
    }
    
    /** Test the setter methods */
    public void testSetter() {
        Chapter c1;
        c1= new Chapter("one", 1, null);
        c1.setTitle("new");
        assertEquals("new", c1.getTitle());
    }
    
       /** Test the setter methods */
    public void testSmaller() {
        Chapter c1= new Chapter("one", 1, null);
        Chapter c2= new Chapter("one", 2, null);
        assertEquals( 1, Chapter.smaller(c1, c2));
        assertEquals( 1, Chapter.smaller(c2, c1));
        assertEquals( 1, Chapter.smaller(c1, c1));
    }
    
}
