|
|
@ -30,8 +30,8 @@ class MyClipboardTest {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ParameterizedTest
|
|
|
|
@ParameterizedTest
|
|
|
|
@MethodSource("provideArgumentsForSuccessfullyRetrievingCorrectClipboardListenerForSystem")
|
|
|
|
@MethodSource("provideArgumentsForSuccessfullyRetrievingCorrectSystemClipboard")
|
|
|
|
void successfullyRetrieveCorrectClipboardListenerForSystem(boolean isMac, boolean isWindows, boolean isUnix, Class<?> expectedListener) throws UnsupportedSystemException {
|
|
|
|
void successfullyRetrieveCorrectSystemClipboard(boolean isMac, boolean isWindows, boolean isUnix, Class<?> expectedListener) throws UnsupportedSystemException {
|
|
|
|
when(systemUtilsMock.isMac()).thenReturn(isMac);
|
|
|
|
when(systemUtilsMock.isMac()).thenReturn(isMac);
|
|
|
|
when(systemUtilsMock.isWindows()).thenReturn(isWindows);
|
|
|
|
when(systemUtilsMock.isWindows()).thenReturn(isWindows);
|
|
|
|
when(systemUtilsMock.isUnix()).thenReturn(isUnix);
|
|
|
|
when(systemUtilsMock.isUnix()).thenReturn(isUnix);
|
|
|
@ -42,7 +42,7 @@ class MyClipboardTest {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void failToRetrieveCorrectClipboardListenerForSystem() {
|
|
|
|
void failToRetrieveCorrectSystemClipboard() {
|
|
|
|
String expectedOperatingSystem = "unknown";
|
|
|
|
String expectedOperatingSystem = "unknown";
|
|
|
|
System.setProperty("os.name", expectedOperatingSystem);
|
|
|
|
System.setProperty("os.name", expectedOperatingSystem);
|
|
|
|
Throwable expectedException = new UnsupportedSystemException("Your Operating System: '" + System.getProperty("os.name") + "' is not supported");
|
|
|
|
Throwable expectedException = new UnsupportedSystemException("Your Operating System: '" + System.getProperty("os.name") + "' is not supported");
|
|
|
@ -57,11 +57,11 @@ class MyClipboardTest {
|
|
|
|
assertThat(actualException.getMessage(), is(expectedException.getMessage()));
|
|
|
|
assertThat(actualException.getMessage(), is(expectedException.getMessage()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Stream<Arguments> provideArgumentsForSuccessfullyRetrievingCorrectClipboardListenerForSystem() {
|
|
|
|
static Stream<Arguments> provideArgumentsForSuccessfullyRetrievingCorrectSystemClipboard() {
|
|
|
|
return Stream.of(
|
|
|
|
return Stream.of(
|
|
|
|
Arguments.of(false, true, false, WindowsOrUnixClipboardListener.class),
|
|
|
|
Arguments.of(false, true, false, WindowsOrUnixClipboard.class),
|
|
|
|
Arguments.of(false, false, true, WindowsOrUnixClipboardListener.class),
|
|
|
|
Arguments.of(false, false, true, WindowsOrUnixClipboard.class),
|
|
|
|
Arguments.of(true, false, false, MacClipboardListener.class)
|
|
|
|
Arguments.of(true, false, false, MacClipboard.class)
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|