date-range added
[staff/due1/sed-hs15-srs-purple.git] / src / test / java / ch / bfh / ti / srs / dataschema / ResourceTest.java
1 /*
2 * Copyright (c) 2015 Berner Fachhochschule, Switzerland.
3 *
4 * Project Smart Reservation System.
5 *
6 * Distributable under GPL license. See terms of license at gnu.org.
7 */
8 package ch.bfh.ti.srs.dataschema;
9
10 import static org.junit.Assert.assertEquals;
11
12 import org.junit.Test;
13
14 import ch.bfh.ti.srs.dataschema.Resource;
15
16 public class ResourceTest {
17
18 @Test
19 public void createResurceTest() throws Exception {
20 Resource testResource = new Resource("N321", "class room");
21 assertEquals("N321", testResource.getName());
22 assertEquals("class room", testResource.getType());
23 }
24
25 @Test(expected=IllegalArgumentException.class)
26 public void createUserInvalidNameTest() throws Exception{
27 Resource testResource = new Resource(null, "class room");
28 }
29
30 @Test
31 public void setAndGetNameTest() throws Exception {
32 Resource testRessource = new Resource("N321", "class room");
33 testRessource.setName("N421");
34 assertEquals("N421", testRessource.getName());
35 testRessource.setName(null);
36 assertEquals(null, testRessource.getName());
37 }
38
39 @Test
40 public void setAndGetTypeTest() throws Exception {
41 Resource testRessource = new Resource("N321", "class room");
42 testRessource.setType("lecture hall");
43 assertEquals("lecture hall", testRessource.getType());
44 testRessource.setType(null);
45 assertEquals(null, testRessource.getType());
46 }
47 }