Home | History | Annotate | Download | only in classfile
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one or more
      3  * contributor license agreements.  See the NOTICE file distributed with
      4  * this work for additional information regarding copyright ownership.
      5  * The ASF licenses this file to You under the Apache License, Version 2.0
      6  * (the "License"); you may not use this file except in compliance with
      7  * the License.  You may obtain a copy of the License at
      8  *
      9  *   http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 package org.apache.bcel.classfile;
     19 
     20 import junit.framework.TestCase;
     21 
     22 public class UtilityTestCase extends TestCase {
     23 
     24     public void testSignatureToStringWithGenerics() throws Exception {
     25     // tests for BCEL-197
     26         assertEquals("generic signature",
     27                 "java.util.Map<X, java.util.List<Y>>",
     28                 Utility.signatureToString("Ljava/util/Map<TX;Ljava/util/List<TY;>;>;"));
     29         assertEquals("generic signature",
     30                 "java.util.Set<? extends java.nio.file.OpenOption>"
     31                 , Utility.signatureToString("Ljava/util/Set<+Ljava/nio/file/OpenOption;>;"));
     32         assertEquals("generic signature",
     33                 "java.nio.file.attribute.FileAttribute<?>[]",
     34                 Utility.signatureToString("[Ljava/nio/file/attribute/FileAttribute<*>;"));
     35     // tests for BCEL-286
     36         assertEquals("generic signature",
     37                 "boofcv.alg.tracker.tld.TldTracker<boofcv.struct.image.ImageGray<boofcv.struct.image.GrayU8>, boofcv.struct.image.GrayI<boofcv.struct.image.GrayU8>>",
     38                 Utility.signatureToString("Lboofcv/alg/tracker/tld/TldTracker<Lboofcv/struct/image/ImageGray<Lboofcv/struct/image/GrayU8;>;Lboofcv/struct/image/GrayI<Lboofcv/struct/image/GrayU8;>;>;"));
     39         assertEquals("generic signature",
     40                 "java.util.Map<?, ?>",
     41                 Utility.signatureToString("Ljava/util/Map<**>;"));
     42         assertEquals("generic signature",
     43                 "com.jme3.util.IntMap<T>.IntMapIterator",
     44                 Utility.signatureToString("Lcom/jme3/util/IntMap<TT;>.IntMapIterator;"));
     45     }
     46 }
     47