GetSourceVersionsTest.java revision 3233:b5d08bc0d224
189857Sobrien/*
289857Sobrien * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
389857Sobrien * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489857Sobrien *
589857Sobrien * This code is free software; you can redistribute it and/or modify it
689857Sobrien * under the terms of the GNU General Public License version 2 only, as
789857Sobrien * published by the Free Software Foundation.
889857Sobrien *
989857Sobrien * This code is distributed in the hope that it will be useful, but WITHOUT
1089857Sobrien * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11218822Sdim * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12218822Sdim * version 2 for more details (a copy is included in the LICENSE file that
1389857Sobrien * accompanied this code).
1489857Sobrien *
1589857Sobrien * You should have received a copy of the GNU General Public License version
1689857Sobrien * 2 along with this work; if not, write to the Free Software Foundation,
1789857Sobrien * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1889857Sobrien *
1989857Sobrien * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2089857Sobrien * or visit www.oracle.com if you need additional information or have any
2189857Sobrien * questions.
2289857Sobrien */
2389857Sobrien
2489857Sobrien/*
2589857Sobrien * @test
2689857Sobrien * @bug 6493690
2789857Sobrien * @summary javadoc should have a javax.tools.Tool service provider
2889857Sobrien * @modules java.compiler
2989857Sobrien *          jdk.compiler
3089857Sobrien * @build APITest
3189857Sobrien * @run main GetSourceVersionsTest
3289857Sobrien */
3389857Sobrien
3489857Sobrienimport java.util.EnumSet;
3589857Sobrienimport java.util.Set;
3689857Sobrienimport javax.lang.model.SourceVersion;
3789857Sobrienimport javax.tools.DocumentationTool;
3889857Sobrienimport javax.tools.ToolProvider;
3989857Sobrien
4089857Sobrien/**
4189857Sobrien * Tests for DocumentationTool.getSourceVersions method.
4289857Sobrien */
4389857Sobrienpublic class GetSourceVersionsTest extends APITest {
4489857Sobrien    public static void main(String... args) throws Exception {
4589857Sobrien        new GetSourceVersionsTest().run();
4689857Sobrien    }
4789857Sobrien
4889857Sobrien    /**
4989857Sobrien     * Verify getSourceVersions.
5089857Sobrien     */
5189857Sobrien    @Test
5289857Sobrien    public void testRun() throws Exception {
5389857Sobrien        DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
5489857Sobrien        Set<SourceVersion> found = tool.getSourceVersions();
5589857Sobrien        Set<SourceVersion> expect = EnumSet.range(SourceVersion.RELEASE_3, SourceVersion.latest());
5689857Sobrien        if (!expect.equals(found)) {
5789857Sobrien            System.err.println("expect: " + expect);
5889857Sobrien            System.err.println(" found: " + expect);
5989857Sobrien            error("unexpected versions");
6089857Sobrien        }
6189857Sobrien    }
6289857Sobrien}
6389857Sobrien
6489857Sobrien