Search in sources :

Example 6 with Car

use of models.Car in project play-cookbook by spinscale.

the class CsvTest method checkThatFindingAllWorks.

@Test
public void checkThatFindingAllWorks() {
    new Car("VW", "Passat").save();
    new Car("VW", "Golf").save();
    Map<String, String> emptyMap = Collections.emptyMap();
    CsvQuery query = new CsvQuery(Car.class, emptyMap);
    List<Car> cars = query.fetch();
    assertEquals(3, cars.size());
    assertValidCar(cars.get(0), "BMW", "320");
    assertValidCar(cars.get(1), "VW", "Passat");
    assertValidCar(cars.get(2), "VW", "Golf");
}
Also used : CsvQuery(play.modules.csv.CsvQuery) Car(models.Car) UnitTest(play.test.UnitTest) Test(org.junit.Test)

Example 7 with Car

use of models.Car in project play-cookbook by spinscale.

the class CsvTest method checkThatFinderWorks.

@Test
public void checkThatFinderWorks() {
    Car car = Car.find("byBrand", "BMW").first();
    assertValidCar(car, "BMW", "320");
    List<Car> cars = Car.find("byBrandAndType", "BMW", "320").fetch();
    assertValidCar(cars.get(0), "BMW", "320");
    car = Car.find("byTypeAndBrand", "320", "BMW").first();
    assertValidCar(car, "BMW", "320");
}
Also used : Car(models.Car) UnitTest(play.test.UnitTest) Test(org.junit.Test)

Example 8 with Car

use of models.Car in project play-cookbook by spinscale.

the class CsvTest method readSimpleEntityById.

@Test
public void readSimpleEntityById() {
    Car car = Car.findById(1L);
    assertValidCar(car, "BMW", "320");
}
Also used : Car(models.Car) UnitTest(play.test.UnitTest) Test(org.junit.Test)

Aggregations

Car (models.Car)8 Test (org.junit.Test)8 UnitTest (play.test.UnitTest)8 File (java.io.File)2 SolrQuery (org.apache.solr.client.solrj.SolrQuery)2 QueryResponse (org.apache.solr.client.solrj.response.QueryResponse)1 SolrDocumentList (org.apache.solr.common.SolrDocumentList)1 CsvQuery (play.modules.csv.CsvQuery)1 Query (play.modules.solr.Query)1