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