Lab 2 : Mocking and Inheritance


In this lab we will start with the refactored version of the simulator that we worked last time - with generics added. Create a new project based on the latest simulator code


Add Mockito library to the project build path.

  1. Download mockito library mockito-all-1.9.5.jar
  2. Create a new directory in your project called lib
  3. Copy there the downloaded mockito jar file
  4. Right click the jar file and select Build Path -> Add to build path

Exercise 1: Bouncing Creature Fix

Launch the simulator using the Launcher class and try to find the wrong behavior and fix it. Once you are done, write a unit test that verifies that your fix works.

Exercise 2: Smart Creature test

How would you test the emerging behavior of the SmartCreature?


The goal is to refactor the creature simulator according to following class diagram

Class diagram

Attachment sort Action Size Date Who Comment
mockito-all-1.9.5.jar manage 1544.0 K 06 Nov 2012 - 20:39 KrikavaFilip Mockito 1.9.5
schemas.png manage 159.7 K 06 Nov 2012 - 23:36 KrikavaFilip Class diagram manage 9.3 K 06 Nov 2012 - 23:44 KrikavaFilip  

Revision: r1.2 - 06 Nov 2012 - 23:39 - KrikavaFilip
Minfo > SoftEng1213 > SeLab5
Copyright © 1999-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WIKIDeptinfo? Send feedback