import junit.framework.TestCase;

/**
 * A JUnit test sample.
 * Illustrates the toString format.
 */
public class SampleStrategy1Tester extends TestCase {  

  public void testHangUpArray() {
    
    Strategy s = new Strategy1( 5 );
    
    Phone p1 = new Phone( "1234567" );
    Phone p2 = new Phone( "2345678" );
    Phone p3 = new Phone( "3456789" );
    Phone p4 = new Phone( "4567890" );
    Phone p5 = new Phone( "5678901" );
    
    s.makeCall( null, p1 );
    s.makeCall( p1, p2 );
    s.makeCall( p1, p3 );
    s.makeCall( p2, p4 );
    s.makeCall( p1, p5 );    
    assertEquals( "5678901\n4567890\n3456789\n2345678\n1234567\n", s.toString() );
    
    s.hangUp( p5 );
    assertEquals( "4567890\n3456789\n2345678\n1234567\n", s.toString() );    
    s.makeCall( p1, p5 );    
    assertEquals( "5678901\n4567890\n3456789\n2345678\n1234567\n", s.toString() );
    
    s.hangUp( p3 );
    assertEquals( "2345678\n1234567\n", s.toString() );
  }
}
