Advertisement
techno-

CircularTest

Nov 4th, 2022
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. package e2;
  2.  
  3. import org.junit.jupiter.api.Test;
  4.  
  5. import java.util.ArrayList;
  6. import java.util.Arrays;
  7. import java.util.List;
  8.  
  9. import static org.junit.jupiter.api.Assertions.*;
  10.  
  11. class CircularTest {
  12.  
  13.  
  14.  
  15.     List<String> lista = new ArrayList<String>(Arrays.asList("1","2","3","4","5"));
  16.     //Circular
  17.  
  18.     Circular circ = new Circular(lista,3);
  19.  
  20.  
  21.  
  22.     @Test
  23.     void hasNext() {
  24.         assertTrue(circ.hasNext());
  25.         circ.remove();
  26.         circ.remove();
  27.         circ.remove();
  28.         circ.remove();
  29.         assertFalse(circ.hasNext());
  30.     }
  31.  
  32.     @Test
  33.     void next() {
  34.         assertEquals("3",circ.next());
  35.         circ.remove();
  36.         assertEquals("1",circ.next());
  37.         circ.remove();
  38.         assertEquals("5",circ.next());
  39.         circ.remove();
  40.         assertEquals("2",circ.next());
  41.     }
  42.  
  43.     @Test
  44.     void remove() {
  45.         circ.remove();
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement