00001
00005 package edu.mit.csail.sdg.squander.examples.javacol;
00006
00007 import java.util.HashMap;
00008 import java.util.Map;
00009 import java.util.Set;
00010
00011 import org.junit.Assert;
00012 import org.junit.Test;
00013
00014 import edu.mit.csail.sdg.squander.examples.javacol.TypeParamsEx;
00015
00016 public class TypeParamsTest {
00017
00018 @Test
00019 public void test1() {
00020 TypeParamsEx tpe = new TypeParamsEx();
00021 Assert.assertEquals(5, tpe.findInt("V"));
00022 Assert.assertEquals(5, tpe.findInt("5"));
00023 Assert.assertEquals(1, tpe.findInt("I"));
00024
00025 Set<String> set = new TypeParamsEx().common();
00026 Assert.assertEquals("[str1]", set.toString());
00027
00028 tpe.common2();
00029 Assert.assertEquals("[str1]", tpe.sss.toString());
00030
00031 Map<String, Integer> m = new HashMap<String, Integer>();
00032 m.put("111", 1);
00033 m.put("222", 2);
00034 m.put("555", 5);
00035 Assert.assertEquals(1, (int)TypeParamsEx.get(m, "111"));
00036 Assert.assertEquals(2, (int)TypeParamsEx.get(m, "222"));
00037 Assert.assertEquals(5, (int)TypeParamsEx.get(m, "555"));
00038 }
00039
00040 }