author | jjg |
Wed, 29 Oct 2014 17:25:23 -0700 | |
changeset 27319 | 030080f03e4f |
parent 21705 | 36a0348f91b4 |
child 30730 | d3ce7619db2c |
permissions | -rw-r--r-- |
21705
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
1 |
/* |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
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 |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
28 |
* @build APITest |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
29 |
* @run main DocumentationToolLocationTest |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
30 |
*/ |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
31 |
|
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
32 |
import javax.tools.DocumentationTool; |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
33 |
import java.util.Objects; |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
34 |
|
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
35 |
/** |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
36 |
* Test for DocumentationTool.Location methods. |
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 |
public class DocumentationToolLocationTest extends APITest { |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
39 |
public static void main(String[] args) throws Exception { |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
40 |
new DocumentationToolLocationTest().run(); |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
41 |
} |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
42 |
|
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 |
* Test getName() method |
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 |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
47 |
public void testGetName() throws Exception { |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
48 |
// 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
|
49 |
for (DocumentationTool.Location dl: DocumentationTool.Location.values()) { |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
50 |
String expect = dl.name(); |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
51 |
String found = dl.getName(); |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
52 |
if (!Objects.equals(expect, found)) |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
53 |
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
|
54 |
} |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
55 |
} |
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 |
* Test generated enum methods values() and valueOf() |
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 |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
61 |
public void testEnumMethods() throws Exception { |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
62 |
DocumentationTool.Location[] values = DocumentationTool.Location.values(); |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
63 |
if (values.length != 3) |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
64 |
throw new Exception("unexpected number of values returned"); |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
65 |
|
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
66 |
for (DocumentationTool.Location dl: values) { |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
67 |
DocumentationTool.Location expect = dl; |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
68 |
DocumentationTool.Location found = DocumentationTool.Location.valueOf(dl.name()); |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
69 |
if (!Objects.equals(expect, found)) |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
70 |
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
|
71 |
} |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
72 |
} |
36a0348f91b4
8025844: Need test to provide coverage for new DocumentationTool.Location enum
cl
parents:
diff
changeset
|
73 |
} |