1 package net.sf.msplice.model;
2
3 import net.sf.msplice.visitor.IVisitor;
4
5 import org.jmock.Mock;
6 import org.jmock.MockObjectTestCase;
7
8 public class ViewPropertyTest extends MockObjectTestCase {
9
10 private String viewPropertyName = "view-property-name";
11
12 private ViewProperty aViewProperty = null;
13
14 @Override
15 protected void setUp() throws Exception {
16 super.setUp();
17
18 aViewProperty = new ViewProperty();
19 }
20
21 public void testSetName() throws Exception {
22
23 aViewProperty.setName(viewPropertyName);
24
25 String resultName = aViewProperty.getName();
26
27 assertEquals("Checking the name", viewPropertyName, resultName);
28
29 }
30
31 public void testSetNullName() throws Exception {
32
33 aViewProperty.setName(null);
34
35 String resultName = aViewProperty.getName();
36
37 assertNull("Checking the name", resultName);
38
39 }
40
41 public void testVisitor() throws Exception {
42
43
44 Mock mockVisitor = mock(IVisitor.class);
45
46
47 mockVisitor.expects(once()).method("visit").with(eq(aViewProperty));
48
49 aViewProperty.accept((IVisitor) mockVisitor.proxy());
50 }
51 }