Examples of ExceptionExpectation


Examples of org.javalite.test.jspec.ExceptionExpectation

    @Test
    public void testSetWrongAttribute() {
        deleteAndPopulateTable("people");
        final Person p = new Person();
        expect(new ExceptionExpectation(IllegalArgumentException.class) {
            public void exec() {
                p.set("NAME1", "Igor");
            }
        });
    }
View Full Code Here

Examples of org.javalite.test.jspec.ExceptionExpectation

    @Test
    public void testAttemptSetId() {
        deleteAndPopulateTable("people");
        final Person p = new Person();

        expect(new ExceptionExpectation(IllegalArgumentException.class) {
            public void exec() {
                p.set("person_id", "hehe");
            }
        });
    }
View Full Code Here

Examples of org.javalite.test.jspec.ExceptionExpectation

    @Test
    public void testOneToManyWrongAssociation() {
        deleteAndPopulateTables("users", "addresses");
        final User user = User.findById(1);
        expect(new ExceptionExpectation(NotAssociatedException.class){
            public void exec() {
                user.getAll(Book.class);//wrong table
            }
        });

        expect(new ExceptionExpectation(NotAssociatedException.class){
            public void exec() {
                user.getAll(Book.class);//non-existent table
            }
        });
View Full Code Here

Examples of org.javalite.test.jspec.ExceptionExpectation

        a.set("zip", "60074");
        u.add(a);

        a.delete();

        expect(new ExceptionExpectation(FrozenException.class) {
            public void exec() {
                a.saveIt();
            }
        });

        expect(new ExceptionExpectation(FrozenException.class) {
            public void exec() {
                u.add(a);
            }
        });
View Full Code Here

Examples of org.javalite.test.jspec.ExceptionExpectation

    public void shouldOpenConnectionFromDataSource(){

        new DB("default").open(new MockDataSource());
        a(Base.connection()).shouldNotBeNull();
        new DB("default").close();
        expect(new ExceptionExpectation(DBException.class) {
            @Override
            public void exec() {
                Base.connection();
            }
        });
View Full Code Here

Examples of org.javalite.test.jspec.ExceptionExpectation

        deleteAndPopulateTables("users", "addresses");
        final User u = new User();

        //cause exception
        u.set("email", "this is not email value");
        expect(new ExceptionExpectation(ValidationException.class) {
            public void exec() {
                u.saveIt();         
            }
        });
    }
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.