KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > util > AssertTests


1 /*
2  * Copyright 2004-2005 the original author or authors.
3  */

4 package org.springframework.util;
5
6 import java.util.HashMap JavaDoc;
7 import java.util.HashSet JavaDoc;
8 import java.util.Set JavaDoc;
9
10 import junit.framework.TestCase;
11
12 /**
13  *
14  * @author Keith Donald
15  */

16 public class AssertTests extends TestCase {
17     public void testInstanceOf() {
18         Set JavaDoc set = new HashSet JavaDoc();
19         Assert.isInstanceOf(HashSet JavaDoc.class, set);
20         try {
21             Assert.isInstanceOf(HashMap JavaDoc.class, set);
22             fail("Should have failed - a hash map is not a set");
23         } catch (IllegalArgumentException JavaDoc e) {
24             return;
25         }
26     }
27 }
28
Popular Tags