PageRenderTime 24ms CodeModel.GetById 17ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/sigmah/src/test/java/org/sigmah/client/mock/MockStateManager.java

http://sigma-h.googlecode.com/
Java | 51 lines | 32 code | 12 blank | 7 comment | 0 complexity | 6f15741859c51a346a6a2b2289c7811d MD5 | raw file
 1/*
 2 * All Sigmah code is released under the GNU General Public License v3
 3 * See COPYRIGHT.txt and LICENSE.txt.
 4 */
 5
 6package org.sigmah.client.mock;
 7
 8import org.sigmah.client.util.state.IStateManager;
 9
10import java.util.Date;
11import java.util.HashMap;
12import java.util.Map;
13
14/**
15 * @author Alex Bertram (akbertram@gmail.com)
16 */
17public class MockStateManager implements IStateManager {
18
19
20    Map<String, Object> state = new HashMap<String, Object>();
21
22    @Override
23    public Object get(String name) {
24        return state.get(name);
25    }
26
27    @Override
28    public Date getDate(String name) {
29        return (Date)get(name);
30    }
31
32    @Override
33    public Integer getInteger(String name) {
34        return (Integer)get(name);
35    }
36
37    @Override
38    public Map<String, Object> getMap(String name) {
39        return (Map<String,Object>)get(name);
40    }
41
42    @Override
43    public String getString(String name) {
44        return (String)get(name);
45    }
46
47    @Override
48    public void set(String name, Object value) {
49        state.put(name, value);
50    }
51}