Package models

Examples of models.User.save()


            public void run() {
                User user1 = new User("foo@foo.com", "password", "John Doe");
                user1.save();

                User user2 = new User("bar@foo.com", "password", "Jane Doe");
                user2.save();

                List<User> users = User.find.all();

                assertThat(users.size()).isEqualTo(2);
            }
View Full Code Here


    @Test
    public void findByEmailAddressAndPassword() {
        running(fakeApplication(inMemoryDatabase()), new Runnable() {
            public void run() {
                User newUser = new User("foo@foo.com", "password", "John Doe");
                newUser.save();

                User foundUser = User.findByEmailAddressAndPassword("foo@foo.com", "password");

                assertThat(foundUser).isNotNull();
                assertThat(foundUser.fullName).isEqualTo("John Doe");
View Full Code Here

    @Test
    public void findByEmailAddressDifferentCaseAndPassword() {
        running(fakeApplication(inMemoryDatabase()), new Runnable() {
            public void run() {
                User newUser = new User("foo@foo.com", "password", "John Doe");
                newUser.save();

                User foundUser = User.findByEmailAddressAndPassword("FOO@FOO.COM", "password");

                assertThat(foundUser).isNotNull();
                assertThat(foundUser.fullName).isEqualTo("John Doe");
View Full Code Here

    @Test
    public void findByInvalidEmailAddressAndPassword() {
        running(fakeApplication(inMemoryDatabase()), new Runnable() {
            public void run() {
                User newUser = new User("foo@foo.com", "password", "John Doe");
                newUser.save();

                User foundUser = User.findByEmailAddressAndPassword("foo@foo.com", "wrong!");

                assertThat(foundUser).isNull();
            }
View Full Code Here

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.