daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Oct 15th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package gof.prototype;
  7.  
  8. import org.junit.After;
  9. import org.junit.AfterClass;
  10. import org.junit.Before;
  11. import org.junit.BeforeClass;
  12. import org.junit.Test;
  13. import static org.junit.Assert.*;
  14.  
  15. /**
  16.  *
  17.  * @author student
  18.  */
  19. public class CarTest {
  20.     Car orginalcar;
  21.    
  22.     public CarTest() {
  23.     }
  24.    
  25.     @BeforeClass
  26.     public static void setUpClass() {
  27.     }
  28.    
  29.     @AfterClass
  30.     public static void tearDownClass() {
  31.     }
  32.    
  33.     @Before
  34.     public void setUp() {
  35.         orginalcar = new Car("polonez",2.0,100);
  36.     }
  37.    
  38.     @After
  39.     public void tearDown() {
  40.     }
  41.  
  42.     /**
  43.      * Test of equals method, of class Car.
  44.      */
  45.     @Test
  46.     public void testShallowClone() {
  47.  
  48.         Car copy = orginalcar.shallowClone();
  49.         assertEquals(orginalcar, copy);//musi przejsc
  50.         assertNotSame("ShallowClone test ten sam obiekt", orginalcar, copy);
  51.         assertSame("ShallowClone test te same silniki", copy.engine, orginalcar.engine);
  52.     }
  53.     @Test
  54.     public void testDeepClone() {
  55.  
  56.         Car copy = orginalcar.deepClone();
  57.         assertEquals(orginalcar, copy);//musi przejsc
  58.         assertNotSame("DeepClone test ten sam obiekt", orginalcar, copy);
  59.         assertNotSame("DeepClone test ten sam silnik", copy.engine, orginalcar.engine);
  60.     }
  61.    
  62. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top