01: /*
02: * Copyright (C) The DNA Group. All rights reserved.
03: *
04: * This software is published under the terms of the DNA
05: * Software License version 1.1, a copy of which has been included
06: * with this distribution in the LICENSE.txt file.
07: */
08: package org.codehaus.dna.impl;
09:
10: import junit.framework.TestCase;
11:
12: public class FreezableTestCase extends TestCase {
13: public void testMakeReadOnly() throws Exception {
14: final MockFreezable freezable = new MockFreezable();
15: assertEquals("freezable.isReadOnly() prior to makeReadOnly",
16: false, freezable.isReadOnly());
17: freezable.makeReadOnly();
18: assertEquals("freezable.isReadOnly() after to makeReadOnly",
19: true, freezable.isReadOnly());
20: }
21:
22: public void testCheckWriteable() throws Exception {
23: final MockFreezable freezable = new MockFreezable();
24: freezable.makeReadOnly();
25: try {
26: freezable.checkWriteable();
27: } catch (final IllegalStateException ise) {
28: return;
29: }
30: fail("Expected checkWriteable to throw an "
31: + "IllegalStateException as freezable is"
32: + "marked as read-only.");
33: }
34:
35: public void testCheckWriteableOnWriteable() throws Exception {
36: final MockFreezable freezable = new MockFreezable();
37: freezable.checkWriteable();
38: }
39: }
|