Skip to content

Commit

Permalink
fix(isMacStyle): in Java, & is a bit-wise AND operator, not a logical…
Browse files Browse the repository at this point in the history
… AND operator
  • Loading branch information
RalfBarkow committed May 14, 2024
1 parent 241875a commit 156a208
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public class Settings {
* feel
*/
public boolean isMacStyle() {
return PlatformUtil.isMacOS() & getLookAndFeel().contains("Aqua");
return getLookAndFeel().contains("Aqua") && PlatformUtil.isMacOS();
}

public boolean isSeaGlass() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ void MainDataFile_setMainDataFile_Success() throws IOException {
}

@Test
void isMacStyle_MacOSWithAquaLookAndFeel_ReturnsTrue() {
Settings settings = new Settings();
// Set up the environment to simulate macOS with Aqua look and feel
// For example:
// Mocking PlatformUtil to return true for isMacOS()
// Mocking getLookAndFeel() to return a value containing "Aqua"

assertTrue(settings.isMacStyle());
}
void isMacStyle_MacOSWithAquaLookAndFeel_ReturnsTrue() {
Settings settings = new Settings();

if (System.getProperty("os.name").toLowerCase().startsWith("mac os") == true) {
assertTrue(settings.isMacStyle());
} else {
assertFalse(settings.isMacStyle());
}
}

@Test
void loadSettings_FileNotFound_ReturnsFalse() {
Expand Down

0 comments on commit 156a208

Please sign in to comment.