package phoneSimulation;
import phoneSimulation.Scientist.ResearchArea;
import phoneSimulation.Technician.Expertise;
public class Test_Klasse {
/**
* @param args
*/
public static void main(String[] args) {
Person[] liste = new Person[9];
Student studi1 = new Student("studi1", 5551, "studi1@student.de", 5551);
Student studi2 = new Student("studi2", 5552, "studi2@student.de", 5552);
Student studi3 = new Student("studi3", 5553, "studi3@student.de", 5553);
Scientist sci1 = new Scientist("sci1", 0001, "sci1@Scientist.de",
ResearchArea.Physics);
Scientist sci2 = new Scientist("sci2", 0002, "sci2@Scientist.de",
ResearchArea.Computerscience);
Scientist sci3 = new Scientist("sci3", 0003, "sci3@Scientist.de",
ResearchArea.Mathematics);
Technician tech1 = new Technician("tech1", 3331, "tech1@Techncian.de",
Expertise.Workstation);
Technician tech2 = new Technician("tech2", 3332, "tech2@Techncian.de",
Expertise.Server);
Technician tech3 = new Technician("tech3", 3333, "tech3@Techncian.de",
Expertise.Networks);
liste[0] = studi1;
liste[1] = studi2;
liste[2] = studi3;
liste[3] = sci1;
liste[4] = sci2;
liste[5] = sci3;
liste[6] = tech1;
liste[7] = tech2;
liste[8] = tech3;
// System.out.println(studi1);
// System.out.println(studi2);
// System.out.println(studi3);
// System.out.println("-----");
// System.out.println(sci1);
// System.out.println(sci2);
// System.out.println(sci3);
// System.out.println("-----");
// System.out.println(tech1);
// System.out.println(tech2);
// System.out.println(tech3);
// System.out.println("-----");
try {
/**
* 1. Exception (Wissenschaftler darf keinen Studenten anrufen !
* Funktioniert!
*/
System.out.println(sci1.call(studi2));
System.out.println("-------");
/**
* 2. Exception(Student darf keinen Techniker
* anrufen ! Funktioniert!
*/
System.out.println(studi1.call(tech2));
System.out.println("-------");
/**
* 3. Exception man darf/soll sich nicht selber anrufen!!
* Funktioniert !!!
*/
System.out.println(studi2.call(studi2));
System.out.println("-------");
}
catch (ScientistCallsStudentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (StudentCallsTechException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SelfCallException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}