PJF16

CD Player JUnit Test

Apr 8th, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.51 KB | None | 0 0
  1. package cdplayerstate;
  2.  
  3. import org.junit.After;
  4. import org.junit.AfterClass;
  5. import org.junit.Before;
  6. import org.junit.BeforeClass;
  7. import org.junit.Test;
  8. import static org.junit.Assert.*;
  9.  
  10. /**
  11.  *
  12.  * @author philipp
  13.  */
  14. public class CDPlayerTest {
  15.    
  16.     public CDPlayerTest() {
  17.     }
  18.    
  19.     @BeforeClass
  20.     public static void setUpClass() {
  21.     }
  22.    
  23.     @AfterClass
  24.     public static void tearDownClass() {
  25.     }
  26.    
  27.     @Before
  28.     public void setUp() {
  29.     }
  30.    
  31.     @After
  32.     public void tearDown() {
  33.     }
  34.  
  35.     /**
  36.      * Test of setState method, of class CDPlayer.
  37.      */
  38.     @Test
  39.     public void testSetState() {
  40.         System.out.println("setState");
  41.         CDPlayer instance = new CDPlayer();
  42.         CDPlayerInterface state = new Normal(instance);
  43.         instance.setState(state);
  44.         assertEquals (state.getClass(), instance.getState().getClass());
  45.     }
  46.  
  47.     /**
  48.      * Test of faster method, of class CDPlayer.
  49.      */
  50.     @Test
  51.     public void testFaster() {
  52.         System.out.println("faster");
  53.         CDPlayer instance = new CDPlayer();
  54.         instance.faster();
  55.         assertEquals (instance.getState().getClass(), Faster.class);
  56.     }
  57.  
  58.     /**
  59.      * Test of slower method, of class CDPlayer.
  60.      */
  61.     @Test
  62.     public void testSlower() {
  63.         System.out.println("slower");
  64.         CDPlayer instance = new CDPlayer();
  65.         instance.slower();
  66.         assertEquals (instance.getState().getClass(), Slower.class);
  67.     }
  68.    
  69. }
Advertisement
Add Comment
Please, Sign In to add comment