Permalink
Browse files

Har teste saveAppointment() og den virker i hvertfall for meg...

  • Loading branch information...
1 parent 1449d2f commit ea44cb90a68cbf1f2a28555607eed4f41c4a6bbf Andreas Lovland committed Mar 28, 2012
Showing with 25 additions and 1 deletion.
  1. +0 −1 src/no/ntnu/fp/server_logic/SqlRequestImpl.java
  2. +25 −0 src/no/ntnu/fp/tests/SqlRequestImplTest.java
@@ -208,7 +208,6 @@ public void getAppointment(int ID) {
@Override
public void saveAppointment(Appointment appointment) {
- //not tested!!!
String queryString = statementFormer.addAppointment(appointment);
try{
statement.executeUpdate(queryString);
@@ -32,6 +32,7 @@ public static void main (String args[]){
sqlRequestImplTest.testGetAppointments();
sqlRequestImplTest.testGetMessages();
sqlRequestImplTest.testGetAppointmentStatus();
+ sqlRequestImplTest.testSaveAppointment(); //funksjonen håndterer ID selv...
}
@@ -273,7 +274,31 @@ public Appointment getAppointment(int AppointmentID){
}
+ public void testSaveAppointment(){
+ GregorianCalendar startDate = new GregorianCalendar();
+ startDate.set(1990,12,8,2,45,34);
+ GregorianCalendar endDate = new GregorianCalendar();
+ endDate.set(2034,8,12,14,12,23);
+ Appointment appointment = new Appointment("dette er en app(ointment)","shit, testing tar tid...",startDate,endDate);
+ appointment.setPlace("ute på bøljan blå");
+ appointment.setIsRoom(false);
+
+ try{
+ Socket socket = new Socket("127.0.0.1",6789); //setting up a connection to the server
+ ObjectOutputStream objectOutputStream= new ObjectOutputStream(socket.getOutputStream()); //outPutStream for sending the request
+ Object[] pack = {"saveAppointment()",appointment};
+ objectOutputStream.writeObject(pack);
+ objectOutputStream.flush();
+
+ objectOutputStream.close();
+ socket.close();
+ }
+ catch (Exception e){
+ System.out.println(e);
+ assertTrue(false);
+ }
+ }

0 comments on commit ea44cb9

Please sign in to comment.