Moving around a lot of files to work towards production components.
[utils] / system / general / src / test / java / org / wamblee / system / core / DefaultRequiredInterfaceTest.java
1 /*
2  * Copyright 2007 the original author or authors.
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  * 
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  * 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */ 
16 package org.wamblee.system.core;
17
18 import org.wamblee.system.core.DefaultRequiredInterface;
19 import org.wamblee.system.core.RequiredInterface;
20
21 import junit.framework.TestCase;
22
23 public class DefaultRequiredInterfaceTest extends TestCase {
24
25         public void testEquals() { 
26                 assertEquals(
27                                 new DefaultRequiredInterface("a", String.class),
28                                 new DefaultRequiredInterface("a", String.class));
29                 assertEquals(
30                                 new DefaultRequiredInterface("a", new Class[]{ String.class, Integer.class}),
31                                 new DefaultRequiredInterface("a", new Class[]{ String.class, Integer.class}));
32                 
33                 assertFalse(
34                                 new DefaultRequiredInterface("a", String.class).equals(
35                                 new DefaultRequiredInterface("a", Integer.class)));
36                 assertFalse(
37                                 new DefaultRequiredInterface("a", new Class[]{ String.class}).equals(
38                                 new DefaultRequiredInterface("a", new Class[]{ String.class, Integer.class})));
39                 
40         }
41         
42         public void testCopy() { 
43             DefaultRequiredInterface required = new DefaultRequiredInterface("a", new Class[]{ String.class, Integer.class}, true);
44             RequiredInterface copy = required.copy(); 
45             assertTrue(copy instanceof DefaultRequiredInterface); 
46             assertEquals(required.getName(), copy.getName());
47             assertEquals(required.isOptional(), copy.isOptional()); 
48             assertEquals(required.toString(), copy.toString());
49         }
50 }