final Properties p = new Properties();
p.put("movieDatabase", "new://Resource?type=DataSource");
p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
EJBContainer container = EJBContainer.createEJBContainer(p);
final Context context = container.getContext();
final Movies movies = (Movies) context.lookup("java:global/jpa-enumerated/Movies");
movies.addMovie(new Movie("James Frawley", "The Muppet Movie", 1979, Rating.G));
movies.addMovie(new Movie("Jim Henson", "The Great Muppet Caper", 1981, Rating.G));
movies.addMovie(new Movie("Frank Oz", "The Muppets Take Manhattan", 1984, Rating.G));
movies.addMovie(new Movie("James Bobin", "The Muppets", 2011, Rating.PG));
assertEquals("List.size()", 4, movies.getMovies().size());
assertEquals("List.size()", 3, movies.findByRating(Rating.G).size());
assertEquals("List.size()", 1, movies.findByRating(Rating.PG).size());
assertEquals("List.size()", 0, movies.findByRating(Rating.R).size());
container.close();
}