UserControllerTest updated
[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 import static org.junit.Assert.assertNotEquals;
12
13 import org.junit.Test;
14
15 import ch.bfh.ti.srs.dataschema.Resource;
16
17 public class ResourceTest {
18
19 @Test
20 public void createResurceTest() throws Exception {
21 Resource testResource = new Resource("N321", "class room");
22 assertNotEquals(null, testResource.getId());
23 assertEquals("N321", testResource.getName());
24 assertEquals("class room", testResource.getType());
25 }
26
27 @Test(expected=IllegalArgumentException.class)
28 public void createUserInvalidNameTest() throws Exception{
29 Resource testResource = new Resource(null, "class room");
30 }
31
32 @Test
33 public void setAndGetNameTest() throws Exception {
34 Resource testRessource = new Resource("N321", "class room");
35 testRessource.setName("N421");
36 assertEquals("N421", testRessource.getName());
37 testRessource.setName(null);
38 assertEquals(null, testRessource.getName());
39 }
40
41 @Test
42 public void setAndGetTypeTest() throws Exception {
43 Resource testRessource = new Resource("N321", "class room");
44 testRessource.setType("lecture hall");
45 assertEquals("lecture hall", testRessource.getType());
46 testRessource.setType(null);
47 assertEquals(null, testRessource.getType());
48 }
49 }