Skip to content

Commit bd88697

Browse files
committed
chore: create a system provider class for the browser system definition
1 parent 351b187 commit bd88697

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

com.developer.nefarious.zjoule.plugin/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Export-Package:
3030
com.developer.nefarious.zjoule.plugin.core.events,
3131
com.developer.nefarious.zjoule.plugin.core.functions,
3232
com.developer.nefarious.zjoule.plugin.core.ui,
33+
com.developer.nefarious.zjoule.plugin.core.utils,
3334
com.developer.nefarious.zjoule.plugin.login,
3435
com.developer.nefarious.zjoule.plugin.login.api,
3536
com.developer.nefarious.zjoule.plugin.login.events,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.developer.nefarious.zjoule.plugin.core.utils;
2+
3+
/**
4+
* Utility class for providing information about the current operating system.
5+
* <p>
6+
* This class is designed to be used as a utility and cannot be instantiated.
7+
* It provides a static method to retrieve the name of the operating system
8+
* as reported by the Java Virtual Machine (JVM).
9+
* </p>
10+
*/
11+
public abstract class SystemProvider {
12+
13+
/**
14+
* Retrieves the name of the operating system on which the JVM is currently running.
15+
* <p>
16+
* This method wraps the {@code System.getProperty("os.name")} call, which
17+
* provides the operating system name as a {@code String}.
18+
* </p>
19+
*
20+
* @return the name of the operating system, such as "Windows 10", "Linux", or "Mac OS X".
21+
* The exact value is determined by the underlying JVM implementation.
22+
* @see System#getProperty(String)
23+
*/
24+
public static String getCurrentSystem() {
25+
return System.getProperty("os.name");
26+
}
27+
28+
/**
29+
* Private constructor to prevent instantiation of this utility class.
30+
*/
31+
private SystemProvider() { }
32+
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.developer.nefarious.zjoule.test.core.utils;
2+
3+
import static org.junit.jupiter.api.Assertions.assertFalse;
4+
import static org.junit.jupiter.api.Assertions.assertNotNull;
5+
6+
import com.developer.nefarious.zjoule.plugin.core.utils.SystemProvider;
7+
8+
public class SystemProviderTest {
9+
10+
public void shouldReturnTheCurrentSystem() {
11+
// Arrange
12+
// Act
13+
String returnValue = SystemProvider.getCurrentSystem();
14+
// Assert
15+
assertNotNull(returnValue);
16+
assertFalse(returnValue.isBlank());
17+
}
18+
19+
}

0 commit comments

Comments
 (0)