コード例 #1
0
 // test the addPowerup method
 @SuppressWarnings("unchecked")
 void testAddPowerup(Tester t) {
   resetField();
   field.addPowerup(0, 0);
   t.checkOneOf(
       field.pUps,
       new ArrayList<Powerup>(Arrays.asList(avocado)),
       new ArrayList<Powerup>(Arrays.asList(twinkie)));
 }
コード例 #2
0
 // test the generatePowerups method
 void testGeneratePowerups(Tester t) {
   resetField();
   field.generatePowerups(0);
   t.checkExpect(field.pUps, new ArrayList<Powerup>());
   resetField();
   /*
    * field.generatePowerups(1); t.checkOneOf(field, new Field(new
    * ArrayList<Powerup>(Arrays.asList(avocado))), new Field(new
    * ArrayList<Powerup>(Arrays.asList(twinkie))));
    */
   /*
    * resetField(); field.generatePowerups(2); t.checkOneOf(field.pUps,new
    * Field(new ArrayList<Powerup>( Arrays.asList(avocado, avocado))), new
    * Field(new ArrayList<Powerup>( Arrays.asList(avocado, twinkie))), new
    * Field(new ArrayList<Powerup>( Arrays.asList(twinkie, avocado))), new
    * Field(new ArrayList<Powerup>( Arrays.asList(twinkie, twinkie))));
    */
 }
コード例 #3
0
 // test the getYPos method
 void testGetYPos(Tester t) {
   t.checkOneOf(field.getYPos(), CollectTheFruit.height - 35, CollectTheFruit.height - 200);
 }