Package com.javaeye.jert.service.test

Source Code of com.javaeye.jert.service.test.UserPrefsServiceTest

package com.javaeye.jert.service.test;

import java.util.Locale;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.javaeye.jert.domain.user.UserPrefs;
import com.javaeye.jert.service.UserPrefsService;

/**
* @author   Quake Wang
* @since    2005-1-23
* @version $Revision: 1.2 $
*/
public class UserPrefsServiceTest extends TestService {
    private UserPrefsService service;

    protected void setUp() throws Exception {
        super.setUp();
        service = (UserPrefsService) context.getBean("userPrefsService");
    }

    protected ApplicationContext getContext() {
        return new ClassPathXmlApplicationContext("com/javaeye/jert/service/test/UserPrefsServiceTest.xml");
    }
   
    public void test() {
        String userName = "tester";
        UserPrefs userPrefs = new UserPrefs();
        Locale chinese = new Locale("zh", "CN");
        Integer countOnEachPage = new Integer(20);
       
        userPrefs.setUserName(userName);
        userPrefs.setLocale(chinese);
        userPrefs.setCountOnEachPage(countOnEachPage);
        service.createUserPrefs(userPrefs);
       
        UserPrefs stored = service.loadUserPrefs(userName);
        assertEquals(chinese, stored.getLocale());
        assertEquals(countOnEachPage, stored.getCountOnEachPage());
        assertEquals(userName, stored.getUserName());
       
        stored.setLocale(new Locale("en"));
        service.updateUserPrefs(stored);
    }

}
TOP

Related Classes of com.javaeye.jert.service.test.UserPrefsServiceTest

TOP
Copyright © 2018 www.massapi.com. 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.