Code example for Map

Methods: get, size

0
 
    @Test 
    public void getAll_shouldReturnAllValues() throws Exception { 
        editor.commit();
        Map<String, ?> all = sharedPreferences.getAll();
        assertThat(all.size()).isEqualTo(6);
        assertThat((Integer) all.get("int")).isEqualTo(2);
    } 
 
    @Test 
    public void commit_shouldRemoveValuesThenSetValues() throws Exception { 
    	content.put(FILENAME, new HashMap<String, Object>());
    	content.get(FILENAME).put("deleteMe", "foo");
 
    	editor.remove("deleteMe");
    	 
    	editor.putString("dontDeleteMe", "baz");
        editor.remove("dontDeleteMe");
 
        editor.commit();