01: /* Copyright 2004 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.services.persondir.support.merger;
07:
08: import java.util.HashMap;
09: import java.util.Map;
10:
11: /**
12: * Testcase for ReplacingAttributeAdder.
13: * @author andrew.petro@yale.edu
14: * @version $Revision: 35128 $ $Date: 2004-12-13 16:27:49 -0700 (Mon, 13 Dec 2004) $
15: */
16: public class ReplacingAttributeAdderTest extends
17: AttributeMergerAbstractTest {
18:
19: private ReplacingAttributeAdder adder = new ReplacingAttributeAdder();
20:
21: /**
22: * Test that this implementation replaces colliding attributes with the new
23: * attribute values.
24: */
25: public void testReplacement() {
26: Map mapOne = new HashMap();
27: mapOne.put("aaa", "111");
28: mapOne.put("bbb", "222");
29:
30: Map mapTwo = new HashMap();
31: mapTwo.put("bbb", "bbb");
32: mapTwo.put("ccc", "333");
33:
34: Map expected = new HashMap();
35: expected.putAll(mapOne);
36: expected.putAll(mapTwo);
37:
38: Map result = this .adder.mergeAttributes(mapOne, mapTwo);
39: assertEquals(expected, result);
40: }
41:
42: /* (non-Javadoc)
43: * @see org.jasig.portal.services.persondir.support.merger.AttributeMergerAbstractTest#getAttributeMerger()
44: */
45: protected IAttributeMerger getAttributeMerger() {
46: return new ReplacingAttributeAdder();
47: }
48:
49: }
|