2
* Copyright Terracotta, Inc.
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
8
* http://www.apache.org/licenses/LICENSE-2.0
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.
17
package net.sf.ehcache.util;
19
import static org.junit.Assert.*;
21
import java.util.ArrayList;
22
import java.util.Collections;
23
import java.util.Enumeration;
24
import java.util.List;
27
import org.junit.Test;
29
public class MergedEnumerationTest {
33
List<String> list1 = new ArrayList<String>();
36
List<String> list2 = new ArrayList<String>();
39
Enumeration<String> enumeration1 = Collections.enumeration(list1);
40
Enumeration<String> enumeration2 = Collections.enumeration(list2);
42
MergedEnumeration mergedEnumeration = new MergedEnumeration(enumeration1,enumeration2);
44
String[] mergedStrings = new String[4];
46
while(mergedEnumeration.hasMoreElements()){
47
mergedStrings[i] = (String) mergedEnumeration.nextElement();
50
assertEquals("one",mergedStrings[0]);
51
assertEquals("two",mergedStrings[1]);
52
assertEquals("three",mergedStrings[2]);
53
assertEquals("four",mergedStrings[3]);