langtools/test/tools/jdeprscan/tests/jdk/jdeprscan/TestRelease.java
author darcy
Fri, 27 Jan 2017 16:22:08 -0800
changeset 43646 017aba6e9260
parent 41525 7f01e2b0619b
permissions -rw-r--r--
8028544: Add SourceVersion.RELEASE_10 8028546: Add -source 10 and -target 10 to javac Reviewed-by: jjg, smarks

/*
 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */

/*
 * @test
 * @bug 8167965
 * @summary Test proper handling of the --release option.
 * @modules jdk.jdeps/com.sun.tools.jdeprscan
 * @build jdk.jdeprscan.TestRelease
 * @run testng jdk.jdeprscan.TestRelease
 */

package jdk.jdeprscan;

import com.sun.tools.jdeprscan.Main;
import org.testng.annotations.Test;

import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

public class TestRelease {
    static boolean invoke(String arg) {
        return Main.call(System.out, System.err, "--list", "--release", arg);
    }

    @Test
    public void testSuccess() {
        assertTrue(invoke("6"));
        assertTrue(invoke("7"));
        assertTrue(invoke("8"));
        assertTrue(invoke("9"));
        assertTrue(invoke("10"));
    }

    @Test
    public void testFailure() {
        assertFalse(invoke("5"));
    }
}