emul/compact/src/test/java/org/apidesign/bck2brwsr/compact/tck/CollectionsTest.java
1.1 --- a/emul/compact/src/test/java/org/apidesign/bck2brwsr/compact/tck/CollectionsTest.java Mon Feb 25 19:00:08 2013 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,107 +0,0 @@
1.4 -/**
1.5 - * Back 2 Browser Bytecode Translator
1.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
1.7 - *
1.8 - * This program is free software: you can redistribute it and/or modify
1.9 - * it under the terms of the GNU General Public License as published by
1.10 - * the Free Software Foundation, version 2 of the License.
1.11 - *
1.12 - * This program is distributed in the hope that it will be useful,
1.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.15 - * GNU General Public License for more details.
1.16 - *
1.17 - * You should have received a copy of the GNU General Public License
1.18 - * along with this program. Look for COPYING file in the top folder.
1.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
1.20 - */
1.21 -package org.apidesign.bck2brwsr.compact.tck;
1.22 -
1.23 -import java.util.ArrayList;
1.24 -import java.util.Arrays;
1.25 -import java.util.Collection;
1.26 -import java.util.Comparator;
1.27 -import java.util.HashMap;
1.28 -import java.util.HashSet;
1.29 -import java.util.List;
1.30 -import java.util.Map;
1.31 -import java.util.Map.Entry;
1.32 -import java.util.Vector;
1.33 -import org.apidesign.bck2brwsr.vmtest.Compare;
1.34 -import org.apidesign.bck2brwsr.vmtest.VMTest;
1.35 -import org.testng.annotations.Factory;
1.36 -
1.37 -/**
1.38 - *
1.39 - * @author Jaroslav Tulach <jtulach@netbeans.org>
1.40 - */
1.41 -public class CollectionsTest {
1.42 - @Compare public String sortStringsInArray() {
1.43 - List<String> list = new ArrayList<>();
1.44 - list.add("one");
1.45 - list.add("two");
1.46 - list.add("three");
1.47 - list.add("four");
1.48 - list.add("five");
1.49 - list.add("six");
1.50 - list.add("seven");
1.51 - list.add("eight");
1.52 - list.add("nine");
1.53 - list.add("ten");
1.54 -
1.55 - String[] arr = list.toArray(new String[list.size()]);
1.56 - Arrays.sort(arr);
1.57 -
1.58 - return Arrays.asList(arr).toString();
1.59 - }
1.60 -
1.61 - @Compare public String sortStringsInHashSet() {
1.62 - Collection<String> list = new HashSet<>();
1.63 - list.add("one");
1.64 - list.add("two");
1.65 - list.add("three");
1.66 - list.add("four");
1.67 - list.add("five");
1.68 - list.add("six");
1.69 - list.add("seven");
1.70 - list.add("eight");
1.71 - list.add("nine");
1.72 - list.add("ten");
1.73 -
1.74 - String[] arr = list.toArray(new String[0]);
1.75 - Arrays.sort(arr);
1.76 -
1.77 - return Arrays.asList(arr).toString();
1.78 - }
1.79 -
1.80 - @SuppressWarnings("unchecked")
1.81 - @Compare public String sortStringsInHashMapWithComparator() {
1.82 - class C implements Comparator<Map.Entry<String,Integer>> {
1.83 - public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
1.84 - return o1.getKey().compareTo(o2.getKey());
1.85 - }
1.86 - }
1.87 -
1.88 - Map<String,Integer> map = new HashMap<>();
1.89 - map.put("one", 1);
1.90 - map.put("two", 2);
1.91 - map.put("three", 3);
1.92 - map.put("four", 4);
1.93 - map.put("five", 5);
1.94 - map.put("six", 6);
1.95 - map.put("seven", 7);
1.96 - map.put("eight", 8);
1.97 - map.put("nine", 9);
1.98 - map.put("ten", 10);
1.99 -
1.100 - List<Entry<String,Integer>> arr = new Vector<>();
1.101 - arr.addAll(map.entrySet());
1.102 - return arr.toString();
1.103 - }
1.104 -
1.105 - @Factory
1.106 - public static Object[] create() {
1.107 - return VMTest.create(CollectionsTest.class);
1.108 - }
1.109 -
1.110 -}