Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package gof.prototype;
- import org.junit.After;
- import org.junit.AfterClass;
- import org.junit.Before;
- import org.junit.BeforeClass;
- import org.junit.Test;
- import static org.junit.Assert.*;
- /**
- *
- * @author student
- */
- public class CarTest {
- Car orginalcar;
- public CarTest() {
- }
- @BeforeClass
- public static void setUpClass() {
- }
- @AfterClass
- public static void tearDownClass() {
- }
- @Before
- public void setUp() {
- orginalcar = new Car("polonez",2.0,100);
- }
- @After
- public void tearDown() {
- }
- /**
- * Test of equals method, of class Car.
- */
- @Test
- public void testShallowClone() {
- Car copy = orginalcar.shallowClone();
- assertEquals(orginalcar, copy);//musi przejsc
- assertNotSame("ShallowClone test ten sam obiekt", orginalcar, copy);
- assertSame("ShallowClone test te same silniki", copy.engine, orginalcar.engine);
- }
- @Test
- public void testDeepClone() {
- Car copy = orginalcar.deepClone();
- assertEquals(orginalcar, copy);//musi przejsc
- assertNotSame("DeepClone test ten sam obiekt", orginalcar, copy);
- assertNotSame("DeepClone test ten sam silnik", copy.engine, orginalcar.engine);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement