Code example for HashMap

Methods: get, put

0
        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();
 
        TestSharedPreferences anotherSharedPreferences = new TestSharedPreferences(content, FILENAME, 3);
        assertTrue(anotherSharedPreferences.getBoolean("boolean", false));
        assertThat(anotherSharedPreferences.getFloat("float", 666f)).isEqualTo(1.1f);
        assertThat(anotherSharedPreferences.getInt("int", 666)).isEqualTo(2);
        assertThat(anotherSharedPreferences.getLong("long", 666l)).isEqualTo(3l);
        assertThat(anotherSharedPreferences.getString("string", "wacka wa")).isEqualTo("foobar");