Browse Source

Stop using package private method.

pull/147/head
Greg Holmes 9 years ago
parent
commit
20d6006a8b

+ 0
- 4
src/com/dmdirc/config/profiles/ProfileManager.java View File

93
     public Profile getDefault() {
93
     public Profile getDefault() {
94
         return Iterables.getFirst(profiles, defaultProfile);
94
         return Iterables.getFirst(profiles, defaultProfile);
95
     }
95
     }
96
-
97
-    Profile getDefaultProfile() {
98
-        return defaultProfile;
99
-    }
100
 }
96
 }

+ 5
- 5
test/com/dmdirc/config/profiles/IdentitiesProfileMigratorTest.java View File

77
     }
77
     }
78
 
78
 
79
     @Test
79
     @Test
80
-    public void testNeedsMigration_NoProfiles() throws Exception {
80
+    public void testNeedsMigration_NoProfiles() {
81
         when(identityManager.getProvidersByType("profile")).thenReturn(Lists.newArrayList());
81
         when(identityManager.getProvidersByType("profile")).thenReturn(Lists.newArrayList());
82
         assertFalse(instance.needsMigration());
82
         assertFalse(instance.needsMigration());
83
     }
83
     }
84
 
84
 
85
     @Test
85
     @Test
86
-    public void testNeedsMigration_Profiles() throws Exception {
86
+    public void testNeedsMigration_Profiles() {
87
         when(identityManager.getProvidersByType("profile")).thenReturn(
87
         when(identityManager.getProvidersByType("profile")).thenReturn(
88
                 Lists.newArrayList(configProvider1));
88
                 Lists.newArrayList(configProvider1));
89
         assertTrue(instance.needsMigration());
89
         assertTrue(instance.needsMigration());
90
     }
90
     }
91
 
91
 
92
     @Test
92
     @Test
93
-    public void testMigrate_NoIdent() throws Exception {
93
+    public void testMigrate_NoIdent() {
94
         when(identityManager.getProvidersByType("profile")).thenReturn(
94
         when(identityManager.getProvidersByType("profile")).thenReturn(
95
                 Lists.newArrayList(configProvider1));
95
                 Lists.newArrayList(configProvider1));
96
         instance.migrate();
96
         instance.migrate();
99
     }
99
     }
100
 
100
 
101
     @Test
101
     @Test
102
-    public void testMigrate_Ident() throws Exception {
102
+    public void testMigrate_Ident() {
103
         when(identityManager.getProvidersByType("profile")).thenReturn(
103
         when(identityManager.getProvidersByType("profile")).thenReturn(
104
                 Lists.newArrayList(configProvider2));
104
                 Lists.newArrayList(configProvider2));
105
         instance.migrate();
105
         instance.migrate();
108
     }
108
     }
109
 
109
 
110
     @Test
110
     @Test
111
-    public void testMigrate_MultipleNicknames() throws Exception {
111
+    public void testMigrate_MultipleNicknames() {
112
         when(identityManager.getProvidersByType("profile")).thenReturn(
112
         when(identityManager.getProvidersByType("profile")).thenReturn(
113
                 Lists.newArrayList(configProvider3));
113
                 Lists.newArrayList(configProvider3));
114
         instance.migrate();
114
         instance.migrate();

+ 7
- 1
test/com/dmdirc/config/profiles/ProfileManagerTest.java View File

26
 import com.dmdirc.events.ProfileAddedEvent;
26
 import com.dmdirc.events.ProfileAddedEvent;
27
 import com.dmdirc.events.ProfileDeletedEvent;
27
 import com.dmdirc.events.ProfileDeletedEvent;
28
 
28
 
29
+import com.google.common.collect.Lists;
30
+
31
+import java.util.Optional;
32
+
29
 import org.junit.Before;
33
 import org.junit.Before;
30
 import org.junit.Test;
34
 import org.junit.Test;
31
 import org.junit.runner.RunWith;
35
 import org.junit.runner.RunWith;
91
 
95
 
92
     @Test
96
     @Test
93
     public void testGetDefaultProfile_EmptyList() {
97
     public void testGetDefaultProfile_EmptyList() {
94
-        assertEquals(instance.getDefaultProfile(), instance.getDefault());
98
+        final String nick = System.getProperty("user.name").replace(' ', '_');
99
+        final Profile profile = new Profile(nick, nick, Optional.empty(), Lists.newArrayList(nick));
100
+        assertEquals(profile, instance.getDefault());
95
     }
101
     }
96
 
102
 
97
     @Test
103
     @Test

Loading…
Cancel
Save