Debian Codegraph @

platform-tests/src/test/java/org/junit/jupiter/api/condition/OSTests.java

raw
1 /*
2 * Copyright 2015-2024 the original author or authors.
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v2.0 which
6 * accompanies this distribution and is available at
7 *
8 * https://www.eclipse.org/legal/epl-v20.html
9 */
10
11 package org.junit.jupiter.api.condition;
12
13 import static org.junit.jupiter.api.Assertions.assertEquals;
14 import static org.junit.jupiter.api.Assertions.assertNull;
15
16 import org.junit.jupiter.api.Nested;
17 import org.junit.jupiter.params.ParameterizedTest;
18 import org.junit.jupiter.params.provider.NullAndEmptySource;
19 import org.junit.jupiter.params.provider.ValueSource;
20
21 class OSTests {
22 @ParameterizedTest
23 @NullAndEmptySource
24 @ValueSource(strings = { " ", "\t" })
25 void blankOsNameYieldsNull(String name) {
26 assertNull(OS.parse(name));
27 }
28
29 @ParameterizedTest
30 @ValueSource(strings = { "!", "?", "✨", "MINIX" })
31 void unknownOsNameYieldsOTHER(String name) {
32 assertEquals(OS.OTHER, OS.parse(name));
33 }
34
35 @Nested
36 class ValidNames {
37 @ParameterizedTest
38 @ValueSource(strings = { "AIX", "Aix", "LaIxOS" })
39 void aix(String name) {
40 assertEquals(OS.AIX, OS.parse(name));
41 }
42
43 @ParameterizedTest
44 @ValueSource(strings = { "FREEBSD", "FreeBSD" })
45 void freebsd(String name) {
46 assertEquals(OS.FREEBSD, OS.parse(name));
47 }
48
49 @ParameterizedTest
50 @ValueSource(strings = { "LINUX", "Linux" })
51 void linux(String name) {
52 assertEquals(OS.LINUX, OS.parse(name));
53 }
54
55 @ParameterizedTest
56 @ValueSource(strings = { "MAC", "mac" })
57 void mac(String name) {
58 assertEquals(OS.MAC, OS.parse(name));
59 }
60
61 @ParameterizedTest
62 @ValueSource(strings = { "OPENBSD", "OpenBSD" })
63 void openbsd(String name) {
64 assertEquals(OS.OPENBSD, OS.parse(name));
65 }
66
67 @ParameterizedTest
68 @ValueSource(strings = { "SOLARIS", "SunOS" })
69 void solaris(String name) {
70 assertEquals(OS.SOLARIS, OS.parse(name));
71 }
72
73 @ParameterizedTest
74 @ValueSource(strings = { "WINDOW", "Microsoft Windows [Version 10.?]" })
75 void windows(String name) {
76 assertEquals(OS.WINDOWS, OS.parse(name));
77 }
78 }
79 }