Package unit

Source Code of unit.TestUtil

package unit;

import models.User;
import models.User.AccountType;

public class TestUtil {

    public static User createUser(long id) throws Exception {
        AccountType type = (id % 2) == 0 ? AccountType.DROPBOX : AccountType.BOX;
        User user = new User(type);
        user.id = id;
        user.setName("Name " + id);
        user.setToken("sometoken");
        if (type == AccountType.DROPBOX) {
            user.setSecret("somesecret");
        } else if (type == AccountType.BOX) {
            user.email = "e@mail.com";
        }
        user.save();
        return user;
    }

    public static User createUser(User user) throws Exception {
        user.save();
        return user;
    }

    public static void deleteUser(User user) throws Exception {
        user.delete();
    }
}
TOP

Related Classes of unit.TestUtil

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.