langtools/test/tools/javadoc/api/basic/DocumentationToolLocationTest.java
author akulyakh
Thu, 21 May 2015 11:41:04 -0700
changeset 30730 d3ce7619db2c
parent 21705 36a0348f91b4
permissions -rw-r--r--
8076543: Add @modules as needed to the langtools tests Reviewed-by: jjg, shurailine
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21705
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
     1
/*
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 21705
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
21705
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
     4
 *
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
     7
 * published by the Free Software Foundation.
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
     8
 *
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    13
 * accompanied this code).
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    14
 *
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    18
 *
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    21
 * questions.
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    22
 */
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    23
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    24
/*
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    25
 * @test
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    26
 * @bug 8025844
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    27
 * @summary test DocumentationTool.Location methods
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 21705
diff changeset
    28
 * @modules java.compiler
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 21705
diff changeset
    29
 *          jdk.compiler
21705
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    30
 * @build APITest
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    31
 * @run main DocumentationToolLocationTest
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    32
 */
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    33
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    34
import javax.tools.DocumentationTool;
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    35
import java.util.Objects;
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    36
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    37
/**
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    38
 * Test for DocumentationTool.Location methods.
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    39
 */
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    40
public class DocumentationToolLocationTest extends APITest {
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    41
    public static void main(String[] args) throws Exception {
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    42
        new DocumentationToolLocationTest().run();
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    43
    }
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    44
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    45
    /**
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    46
     * Test getName() method
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    47
     */
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    48
    @Test
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    49
    public void testGetName() throws Exception {
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    50
        // getName() returns name(). This is for test coverage of getName.
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    51
        for (DocumentationTool.Location dl: DocumentationTool.Location.values()) {
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    52
            String expect = dl.name();
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    53
            String found = dl.getName();
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    54
            if (!Objects.equals(expect, found))
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    55
                throw new Exception("mismatch for " + dl + "; expected " + expect + ", found " + found);
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    56
        }
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    57
    }
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    58
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    59
    /**
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    60
     * Test generated enum methods values() and valueOf()
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    61
     */
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    62
    @Test
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    63
    public void testEnumMethods() throws Exception {
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    64
        DocumentationTool.Location[] values = DocumentationTool.Location.values();
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    65
        if (values.length != 3)
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    66
            throw new Exception("unexpected number of values returned");
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    67
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    68
        for (DocumentationTool.Location dl: values) {
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    69
            DocumentationTool.Location expect = dl;
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    70
            DocumentationTool.Location found = DocumentationTool.Location.valueOf(dl.name());
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    71
            if (!Objects.equals(expect, found))
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    72
                throw new Exception("mismatch for " + dl + "; expected " + expect + ", found " + found);
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    73
        }
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    74
    }
36a0348f91b4 8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff changeset
    75
}