~ubuntu-branches/ubuntu/trusty/ehcache/trusty

« back to all changes in this revision

Viewing changes to src/test/java/net/sf/ehcache/util/MergedEnumerationTest.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2013-05-06 14:53:07 UTC
  • mfrom: (1.1.7) (2.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130506145307-v5bhw5yu70re00l3
Tags: 2.6.7-1
* Team upload.
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 *  Copyright Terracotta, Inc.
 
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
 
 
17
package net.sf.ehcache.util;
 
18
 
 
19
import static org.junit.Assert.*;
 
20
 
 
21
import java.util.ArrayList;
 
22
import java.util.Collections;
 
23
import java.util.Enumeration;
 
24
import java.util.List;
 
25
 
 
26
 
 
27
import org.junit.Test;
 
28
 
 
29
public class MergedEnumerationTest {
 
30
 
 
31
    @Test
 
32
    public void test() {
 
33
        List<String> list1 = new ArrayList<String>();
 
34
        list1.add("one");
 
35
        list1.add("two");
 
36
        List<String> list2 = new ArrayList<String>();
 
37
        list2.add("three");
 
38
        list2.add("four");
 
39
        Enumeration<String> enumeration1 =  Collections.enumeration(list1);
 
40
        Enumeration<String> enumeration2 =  Collections.enumeration(list2);
 
41
 
 
42
        MergedEnumeration mergedEnumeration = new MergedEnumeration(enumeration1,enumeration2);
 
43
 
 
44
        String[] mergedStrings = new String[4];
 
45
        int i =0;
 
46
        while(mergedEnumeration.hasMoreElements()){
 
47
            mergedStrings[i] = (String) mergedEnumeration.nextElement();
 
48
            i++;
 
49
        }
 
50
        assertEquals("one",mergedStrings[0]);
 
51
        assertEquals("two",mergedStrings[1]);
 
52
        assertEquals("three",mergedStrings[2]);
 
53
        assertEquals("four",mergedStrings[3]);
 
54
 
 
55
    }
 
56
 
 
57
}