test/jdk/tools/jar/multiRelease/whitebox/jdk.jartool/sun/tools/jar/ValidatorComparatorTest.java

Print this page




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @summary White-box test for Validator.ENTRYNAME_COMPARATOR ( currently just
  26  *          checks module descriptors ).
  27  */
  28 package sun.tools.jar;
  29 
  30 import java.util.List;
  31 import static java.util.stream.Collectors.toList;
  32 import static sun.tools.jar.Validator.ENTRYNAME_COMPARATOR;
  33 
  34 import org.testng.Assert;
  35 import org.testng.annotations.Test;
  36 
  37 public class ValidatorComparatorTest {
  38 
  39     @Test
  40     public void testModuleInfo() throws Throwable {
  41         List<String> list =
  42                 List.of("module-info.class",
  43                         "META-INF/versions/9/module-info.class",
  44                         "META-INF/versions/10/module-info.class");
  45         List<String> sorted = list.stream()
  46                 .sorted(ENTRYNAME_COMPARATOR)
  47                 .collect(toList());
  48         List<String> expected = list;
  49         Assert.assertEquals(sorted, expected);
  50 
  51 
  52         list =  List.of("META-INF/versions/10/module-info.class",




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @summary White-box test for Validator.ENTRYNAME_COMPARATOR ( currently just
  26  *          checks module descriptors ).
  27  */
  28 package sun.tools.jar;
  29 
  30 import java.util.List;
  31 import static java.util.stream.Collectors.toList;
  32 import static sun.tools.jar.Main.ENTRYNAME_COMPARATOR;
  33 
  34 import org.testng.Assert;
  35 import org.testng.annotations.Test;
  36 
  37 public class ValidatorComparatorTest {
  38 
  39     @Test
  40     public void testModuleInfo() throws Throwable {
  41         List<String> list =
  42                 List.of("module-info.class",
  43                         "META-INF/versions/9/module-info.class",
  44                         "META-INF/versions/10/module-info.class");
  45         List<String> sorted = list.stream()
  46                 .sorted(ENTRYNAME_COMPARATOR)
  47                 .collect(toList());
  48         List<String> expected = list;
  49         Assert.assertEquals(sorted, expected);
  50 
  51 
  52         list =  List.of("META-INF/versions/10/module-info.class",