Mongo _mongo = new Mongo();
final Mongo mongo = _mongo;
try {
final DB db = mongo.getDB("testdb");
final DBCollection dbCollection = db.getCollection("testCollection");
Artist _artist = new Artist();
final Procedure1<Artist> _function = new Procedure1<Artist>() {
public void apply(final Artist it) {
it.setName("John Coltrane");
final Procedure1<Album> _function = new Procedure1<Album>() {
public void apply(final Album it) {
it.setTitle("A Love Supreme");
it.setYear(1965);
MusicDBXtendTest.this.addTrack(it, "Part 1: Acknowledgement", "7:43");
MusicDBXtendTest.this.addTrack(it, "Part 2: Resolution", "7:20");
MusicDBXtendTest.this.addTrack(it, "Part 3: Pursuance", "10:42");
MusicDBXtendTest.this.addTrack(it, "Part 4: Psalm", "7:05");
}
};
MusicDBXtendTest.this.addAlbum(it, _function);
final Procedure1<Album> _function_1 = new Procedure1<Album>() {
public void apply(final Album it) {
it.setTitle("Impressions");
it.setYear(1961);
MusicDBXtendTest.this.addTrack(it, "India", "13:52");
MusicDBXtendTest.this.addTrack(it, "Up \'gainst the Wall", "3:12");
MusicDBXtendTest.this.addTrack(it, "Impressions", "14:40");
MusicDBXtendTest.this.addTrack(it, "After the Rain", "4:07");
}
};
MusicDBXtendTest.this.addAlbum(it, _function_1);
}
};
final Artist john = ObjectExtensions.<Artist>operator_doubleArrow(_artist, _function);
Iterable<? extends Track> _oevre = john.getOevre();
int _size = IterableExtensions.size(_oevre);
Assert.assertEquals(8, _size);
this._mongoExtensions.save(dbCollection, john);
Artist _artist_1 = new Artist();
final Procedure1<Artist> _function_1 = new Procedure1<Artist>() {
public void apply(final Artist it) {
it.setName("John Coltrane");
}
};
Artist _doubleArrow = ObjectExtensions.<Artist>operator_doubleArrow(_artist_1, _function_1);
final Artist johnFromDb = this._mongoExtensions.<Artist>findOneBean(dbCollection, _doubleArrow);
Assert.assertNotNull(johnFromDb);
List<Album> _albums = johnFromDb.getAlbums();
int _size_1 = _albums.size();
Assert.assertEquals(2, _size_1);
List<Album> _albums_1 = johnFromDb.getAlbums();
final Album albumFromDb = _albums_1.get(1);
Duration _duration = albumFromDb.getDuration();
String _string = _duration.toString();
Assert.assertEquals("35:51", _string);
} finally {