mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Add removeAll to preferences (#987)
This removes all keys except for .type.
This commit is contained in:
committed by
Peter Johnson
parent
2e0709f05b
commit
f90e429bf9
@@ -7,6 +7,7 @@
|
||||
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import java.util.Arrays;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -88,6 +89,25 @@ public class PreferencesTest extends AbstractComsSetup {
|
||||
m_pref.putBoolean("checkedValueBoolean", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Just checking to make sure our helper method works.
|
||||
*/
|
||||
@Test
|
||||
public void testRemove() {
|
||||
remove();
|
||||
assertEquals("Preferences was not empty! Preferences in table: "
|
||||
+ Arrays.toString(m_pref.getKeys().toArray()),
|
||||
1, m_pref.getKeys().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveAll() {
|
||||
m_pref.removeAll();
|
||||
assertEquals("Preferences was not empty! Preferences in table: "
|
||||
+ Arrays.toString(m_pref.getKeys().toArray()),
|
||||
1, m_pref.getKeys().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddRemoveSave() {
|
||||
assertEquals(m_pref.getLong("checkedValueLong", 0), 172L);
|
||||
|
||||
Reference in New Issue
Block a user