Package com.stoyanr.todo.client.util

Examples of com.stoyanr.todo.client.util.LocalStorage


    private static Map<String, Object> stored = new HashMap<String, Object>();
    private static Map<String, Object> serialized = new HashMap<String, Object>();
    // @formatter:on

    public static LocalStorage createMockStorage() {
        LocalStorage storage = mock(LocalStorage.class);
        when(storage.isPresent()).thenReturn(true);
        // @formatter:off
        when(storage.getStringValue(anyString())).thenAnswer(new Answer<String>() {
            public String answer(InvocationOnMock inv) {
                String value = (String) getValue(inv);
                return (value != null)? value : "";
            }
        });
        when(storage.getLongValue(anyString())).thenAnswer(new Answer<Long>() {
            public Long answer(InvocationOnMock inv) {
                Long value = (Long) getValue(inv);
                return (value != null)? value : 0L;
            }
        });
        when(storage.getBooleanValue(anyString())).thenAnswer(new Answer<Boolean>() {
            public Boolean answer(InvocationOnMock inv) {
                Boolean value = (Boolean) getValue(inv);
                return (value != null)? value : false;
            }
        });
View Full Code Here


        public void onSuccess() {
            ItemsView<Item> view = getItemsView();
            Document doc = new Document(userAccount.getUserId(), view.getData(),
                new Date(0));
            DocumentData data = new DocumentData(doc,
                new LocalStorage(storage), new JsonSerializer());
            new DocumentPresenter(itemsSvc, data, view).go(container);
        }
View Full Code Here

TOP

Related Classes of com.stoyanr.todo.client.util.LocalStorage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.