Package com.rapleaf.jack.test_project.database_1.models

Examples of com.rapleaf.jack.test_project.database_1.models.User.save()


    @Test
    public void testCreate() {
        running(fakeApplication(inMemoryDatabase()), new Runnable() {
            public void run() {
                User user = new User("foo@foo.com", "password", "John Doe");
                user.save();
                assertThat(user.id).isNotNull();
                assertThat(user.getEmailAddress()).isEqualTo("foo@foo.com");
                assertThat(user.fullName).isEqualTo("John Doe");
                assertThat(user.creationDate).isNotNull();
View Full Code Here


    @Test(expected = PersistenceException.class)
    public void testCreateWithDuplicateEmail() {
        running(fakeApplication(inMemoryDatabase()), new Runnable() {
            public void run() {
                User user1 = new User("foo@foo.com", "password", "John Doe");
                user1.save();
                User user2 = new User("foo@foo.com", "password", "John Doe");
                user2.save();
            }
        });
    }
View Full Code Here

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

    @Test(expected = PersistenceException.class)
View Full Code Here

    @Test(expected = PersistenceException.class)
    public void testCreateWithDuplicateEmailDifferentCase() {
        running(fakeApplication(inMemoryDatabase()), new Runnable() {
            public void run() {
                User user1 = new User("foo@foo.com", "password", "John Doe");
                user1.save();
                User user2 = new User("FOO@FOO.COM", "password", "John Doe");
                user2.save();
            }
        });
    }
View Full Code Here

        running(fakeApplication(inMemoryDatabase()), new Runnable() {
            public void run() {
                User user1 = new User("foo@foo.com", "password", "John Doe");
                user1.save();
                User user2 = new User("FOO@FOO.COM", "password", "John Doe");
                user2.save();
            }
        });
    }

    @Test
View Full Code Here

    @Test
    public void findAll() {
        running(fakeApplication(inMemoryDatabase()), new Runnable() {
            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();
View Full Code Here

            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.