Package org.javalite.activejdbc.test_models

Examples of org.javalite.activejdbc.test_models.Computer


        populateTable("computers");
    }

    @Test(expected = IllegalArgumentException.class)
    public void shouldRejectNullParent(){
        Computer c = new Computer();
        c.setParent(null);
    }
View Full Code Here


        c.setParent(null);
    }

    @Test(expected = IllegalArgumentException.class)
    public void shouldRejectNewParent(){
        Computer c = new Computer();
        c.setParent(new Motherboard());
    }
View Full Code Here

    @Test(expected = IllegalArgumentException.class)
    public void shouldRejectUnrelatedParent(){

        deleteAndPopulateTable("people");
        Computer c= new Computer();
        c.setParent(Person.findById(1));// must fail because Person and Computer are not related
    }
View Full Code Here

    public void shouldAcceptTwoParents(){

        Motherboard m = Motherboard.createIt("description", "board 1");
        Keyboard k = Keyboard.createIt("description", "blah");

        Computer c = new Computer();
        c.setParent(m);
        c.setParent(k);
        c.save();

        c = Computer.findById(c.getId());
        a(c.get(m.getIdName())).shouldBeEqual(m.getId());
        a(c.get(k.getIdName())).shouldBeEqual(k.getId());
    }
View Full Code Here

        populateTable("computers");
  }
 
  @Test
  public void shouldCheckThatComputerBelongsTo2DifferentParents() {
    Computer computer = Computer.findById(1);
    a(computer.parent(Motherboard.class)).shouldNotBeNull();
    a(computer.parent(Keyboard.class)).shouldNotBeNull();
  }
View Full Code Here

TOP

Related Classes of org.javalite.activejdbc.test_models.Computer

Copyright © 2018 www.massapicom. 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.