01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: TestContentRepository.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.cmf;
09:
10: import junit.framework.TestCase;
11:
12: public class TestContentRepository extends TestCase {
13: public TestContentRepository(String name) {
14: super (name);
15: }
16:
17: public void testInstantiation() {
18: ContentRepository repository = new ContentRepository();
19: assertNotNull(repository);
20:
21: assertNull(repository.getName());
22: }
23:
24: public void testName() {
25: ContentRepository repository = new ContentRepository();
26: repository.setName("anotherone");
27: assertEquals("anotherone", repository.getName());
28: repository.name("stillonemore");
29: assertEquals("stillonemore", repository.getName());
30: repository.setName(null);
31: assertNull(repository.getName());
32: }
33:
34: public void testValidation() {
35: ContentRepository repository = new ContentRepository();
36:
37: repository.resetValidation();
38: assertFalse(repository.validate());
39: assertFalse(repository.isSubjectValid("name"));
40:
41: repository.resetValidation();
42: repository.setName("anotherone");
43: assertTrue(repository.validate());
44: assertTrue(repository.isSubjectValid("name"));
45:
46: repository.resetValidation();
47: assertTrue(repository.validate());
48: assertTrue(repository.isSubjectValid("name"));
49: }
50: }
|