1
2
3
4
5
6
7
8 package org.codehaus.dna.impl;
9
10 import junit.framework.TestCase;
11
12 public class FreezableTestCase
13 extends TestCase
14 {
15 public void testMakeReadOnly()
16 throws Exception
17 {
18 final MockFreezable freezable = new MockFreezable();
19 assertEquals( "freezable.isReadOnly() prior to makeReadOnly",
20 false,
21 freezable.isReadOnly() );
22 freezable.makeReadOnly();
23 assertEquals( "freezable.isReadOnly() after to makeReadOnly",
24 true,
25 freezable.isReadOnly() );
26 }
27
28 public void testCheckWriteable()
29 throws Exception
30 {
31 final MockFreezable freezable = new MockFreezable();
32 freezable.makeReadOnly();
33 try
34 {
35 freezable.checkWriteable();
36 }
37 catch( final IllegalStateException ise )
38 {
39 return;
40 }
41 fail( "Expected checkWriteable to throw an " +
42 "IllegalStateException as freezable is" +
43 "marked as read-only." );
44 }
45
46 public void testCheckWriteableOnWriteable()
47 throws Exception
48 {
49 final MockFreezable freezable = new MockFreezable();
50 freezable.checkWriteable();
51 }
52 }