Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

SuperfluousTest

By: ace on May 12th, 2010  |  syntax: None  |  size: 1.55 KB  |  hits: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. /**
  3.  * Write a new class called Superfluous which allows the test below
  4.  * to pass.
  5.  *
  6.  * @author ace
  7.  * @version 11 April 2010
  8.  */
  9. public class SuperfluousTest
  10. {
  11.  
  12.     /**
  13.      * Constructor for objects of class SuperfluousTest
  14.      */
  15.     public SuperfluousTest(){
  16.     }
  17.  
  18.     /**
  19.      * All March hares are mad.
  20.      * Nothing which is mad is superfluous.
  21.      * All politicians are superfluous.
  22.      * All managers are politicians.
  23.      * All secretaries are mad.
  24.      * All rabbits that are white are wonderous.
  25.      * All wonderous things that are late are rabbits.
  26.      * No wonderous things which are not late are rabbits.
  27.      * Things which are late are superfluous.
  28.      * Are managers superfluous? Are secretaries? Is a white rabbit superfluous?
  29.      */
  30.     public void testIsItSuperfluous(){
  31.         Superfluous superflu = new Superfluous();
  32.         Person manager = new Person();
  33.         manager.setIsAManager();
  34.         Person secretary = new Person();
  35.         secretary.setIsASecretary();
  36.         Person whiteRabbit = new Person();
  37.         whiteRabbit.setIsARabbit();
  38.         whiteRabbit.setIsWhite();
  39.         boolean managerB = superflu.isItSuperfluous(manager);
  40.         boolean secretaryB = superflu.isItSuperfluous(secretary);
  41.         boolean whiteB = superflu.isItSuperfluous(whiteRabbit);
  42.         if(managerB==true && secretaryB == false && whiteB==true){
  43.             System.out.println("testIsItSuperfluous passed!");
  44.         } else {
  45.             System.out.println("testIsItSuperfluous failed");
  46.         }
  47.     }
  48. }