author | herrick |
Fri, 08 Nov 2019 14:53:03 -0500 | |
branch | JDK-8200758-branch |
changeset 58994 | b09ba68c6a19 |
parent 58890 | test/jdk/tools/jpackage/junit/jdk/jpackage/internal/InvalidDottedVersionTest.java@6539ad1d90aa |
permissions | -rw-r--r-- |
58696 | 1 |
/* |
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
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 |
*/ |
|
58994
b09ba68c6a19
8233636 : Make jpackage an incubator and remove tool provider implementation
herrick
parents:
58890
diff
changeset
|
23 |
package jdk.incubator.jpackage.internal; |
58696 | 24 |
|
25 |
import java.util.List; |
|
26 |
import java.util.stream.Collectors; |
|
27 |
import java.util.stream.Stream; |
|
28 |
import org.junit.Rule; |
|
29 |
import org.junit.Test; |
|
30 |
import org.junit.rules.ExpectedException; |
|
31 |
import org.junit.runner.RunWith; |
|
32 |
import org.junit.runners.Parameterized; |
|
33 |
import org.junit.runners.Parameterized.Parameters; |
|
34 |
||
35 |
@RunWith(Parameterized.class) |
|
36 |
public class InvalidDottedVersionTest { |
|
37 |
||
38 |
public InvalidDottedVersionTest(String version) { |
|
39 |
this.version = version; |
|
40 |
} |
|
41 |
||
42 |
@Parameters |
|
43 |
public static List<Object[]> data() { |
|
44 |
return Stream.of( |
|
45 |
"1.-1", |
|
46 |
"5.", |
|
47 |
"4.2.", |
|
48 |
"3..2", |
|
49 |
"2.a", |
|
50 |
"0a", |
|
51 |
".", |
|
52 |
" ", |
|
53 |
" 1", |
|
58890
6539ad1d90aa
8233333 : Incorrect comparison of number version strings in ToolValidator
herrick
parents:
58696
diff
changeset
|
54 |
"1. 2", |
6539ad1d90aa
8233333 : Incorrect comparison of number version strings in ToolValidator
herrick
parents:
58696
diff
changeset
|
55 |
"+1", |
6539ad1d90aa
8233333 : Incorrect comparison of number version strings in ToolValidator
herrick
parents:
58696
diff
changeset
|
56 |
"-1", |
6539ad1d90aa
8233333 : Incorrect comparison of number version strings in ToolValidator
herrick
parents:
58696
diff
changeset
|
57 |
"-0", |
6539ad1d90aa
8233333 : Incorrect comparison of number version strings in ToolValidator
herrick
parents:
58696
diff
changeset
|
58 |
"1234567890123456789012345678901234567890" |
58696 | 59 |
).map(version -> new Object[] { version }).collect(Collectors.toList()); |
60 |
} |
|
61 |
||
62 |
@Rule |
|
63 |
public ExpectedException exceptionRule = ExpectedException.none(); |
|
64 |
||
65 |
@Test |
|
66 |
public void testIt() { |
|
67 |
exceptionRule.expect(IllegalArgumentException.class); |
|
68 |
new DottedVersion(version); |
|
69 |
} |
|
70 |
||
71 |
private final String version; |
|
72 |
} |