forked from microsoft/copilot-for-eclipse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCopilotPreferenceInitializerTest.java
More file actions
42 lines (31 loc) · 1.34 KB
/
Copy pathCopilotPreferenceInitializerTest.java
File metadata and controls
42 lines (31 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package com.microsoft.copilot.eclipse.ui.preferences;
import static org.junit.jupiter.api.Assertions.assertFalse;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import com.microsoft.copilot.eclipse.core.Constants;
import com.microsoft.copilot.eclipse.ui.CopilotUi;
/**
* Test cases for CopilotPreferenceInitializer.
*/
class CopilotPreferenceInitializerTest {
private CopilotPreferenceInitializer initializer;
private IEclipsePreferences configPrefs;
@BeforeEach
void setUp() {
initializer = new CopilotPreferenceInitializer();
configPrefs = ConfigurationScope.INSTANCE.getNode(CopilotUi.getPlugin().getBundle().getSymbolicName());
// Clean up any existing preference to ensure clean test state
configPrefs.remove(Constants.AUTO_SHOW_WHAT_IS_NEW);
}
@Test
void testInitializeDefaultPreferences_WhenAutoShowWhatsNewSetToFalse_ShouldRemainFalse() {
configPrefs.putBoolean(Constants.AUTO_SHOW_WHAT_IS_NEW, false);
initializer.initializeDefaultPreferences();
boolean autoShowWhatsNew = configPrefs.getBoolean(Constants.AUTO_SHOW_WHAT_IS_NEW, true);
assertFalse(autoShowWhatsNew);
}
}