Room TEst
unknown
java
3 years ago
5.2 kB
8
Indexable
package edu.sc.cse4495.MeetingPlanner; import org.junit.Test; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import static org.junit.Assert.*; public class RoomTest { // Add test methods here. // You are not required to write tests for all classes. Room room = new Room(); @Test public void test_getID_room(){ try { String expectedValue=""; String IDc=""; Room room =new Room( IDc); String actualValue=room.getID(); System.out.println("Expected Value="+ expectedValue +" . Actual Value="+actualValue); assertEquals(expectedValue, actualValue); } catch (Exception exception) { exception.printStackTrace(); assertFalse(false); } } @Test public void test_addMeeting_withoutRoominfo(){ try { Meeting meeting = null; String IDc=""; Room room =new Room( IDc); room.addMeeting( meeting); assertTrue(true); } catch (Exception exception) { exception.printStackTrace(); assertFalse(false); } } @Test public void printAgenda_day0(){ try { String expectedValue=""; int month=0; String IDc=""; Room room =new Room( IDc); String actualValue=room.printAgenda( month); System.out.println("Expected Value="+ expectedValue +" . Actual Value="+actualValue); assertEquals(expectedValue, actualValue); } catch (Exception exception) { exception.printStackTrace(); assertFalse(false); } } @Test public void printAgenda_month0_day_0(){ try { String expectedValue=""; int month=0; int day=0; String IDc=""; Room room =new Room( IDc); String actualValue=room.printAgenda( month ,day); System.out.println("Expected Value="+ expectedValue +" . Actual Value="+actualValue); assertEquals(expectedValue, actualValue); } catch (Exception exception) { exception.printStackTrace(); assertFalse(false); } } @Test public void test_RoomisBusy_datetime0(){ try { boolean expectedValue=false; int month=0; int day=0; int start=0; int end=0; String IDc=""; Room room =new Room( IDc); boolean actualValue=room.isBusy( month ,day ,start ,end); System.out.println("Expected Value="+ expectedValue +" . Actual Value="+actualValue); assertEquals(expectedValue, actualValue); } catch (Exception exception) { exception.printStackTrace(); assertFalse(false); } } @Test public void test_getMeeting_dateTime0(){ try { Meeting expectedValue = null; int month=0; int day=0; int index=0; String IDc=""; Room room =new Room( IDc); Meeting actualValue=room.getMeeting( month ,day ,index); System.out.println("Expected Value="+ expectedValue +" . Actual Value="+actualValue); assertEquals(expectedValue, actualValue); } catch (Exception exception) { exception.printStackTrace(); assertFalse(false); } } @Test public void test_getMeeting_validDate(){ try { Meeting expectedValue = null; int month=11; int day=10; int index=0; String IDc=""; Room room =new Room( IDc); Meeting actualValue=room.getMeeting( month ,day ,index); System.out.println("Expected Value="+ expectedValue +" . Actual Value="+actualValue); assertEquals(expectedValue, actualValue); } catch (Exception exception) { exception.printStackTrace(); assertFalse(false); } } @Test public void removeMeeting(){ try { int month=0; int day=0; int index=0; String IDc=""; Room room =new Room( IDc); room.removeMeeting( month ,day ,index); assertTrue(true); } catch (Exception exception) { exception.printStackTrace(); assertFalse(false); } } @Test public void testAddMeeting_ThrowsTimeConflictException() { final Meeting meeting = new Meeting(1, 1, 0, 0, new ArrayList<>(List.of(new Person("name"))), new Room("ID"), "description"); assertThrows(TimeConflictException.class, () -> room.addMeeting(meeting)); } @Test public void testIsBusy_ThrowsTimeConflictException() { assertThrows(TimeConflictException.class, () -> room.isBusy(1, 1, 0, 0)); } }
Editor is loading...