1   /*
2    * Copyright 2002-2006 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy
6    * 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, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package org.springframework.rules.support;
17  
18  import junit.framework.TestCase;
19  
20  import org.springframework.rules.Rules;
21  
22  /**
23   * @author Mathias Broekelmann
24   * 
25   */
26  public class DefaultRulesSourceTests extends TestCase {
27  
28      private DefaultRulesSource source;
29  
30      private Rules interfaceRules;
31  
32      protected void setUp() throws Exception {
33          source = new DefaultRulesSource();
34          interfaceRules = new Rules(TestInterface.class);
35      }
36  
37      protected void tearDown() throws Exception {
38          source = null;
39          interfaceRules = null;
40      }
41  
42      public void testInterfaceRules() {
43          source.addRules(interfaceRules);
44          assertEquals(interfaceRules, source.getRules(TestInterfaceImpl.class));
45      }
46  
47      private static interface TestInterface {
48      }
49  
50      private static class TestInterfaceImpl implements TestInterface {
51      }
52  
53  }