### Question:
MusicFactoryImpl extends RecordFactoryImpl<Music, MusicImpl> implements MusicFactory { public List<Music> findRecentsByType(String ensembleMimeTypes, int count) { final String[] inJoinTables = new String[] { "files" }; final String condition = " file_id = id and music_type in ( " + ensembleMimeTypes + " )"; return findAll(inJoinTables, condition, null, "creation_date DESC ", 0, count); } MusicFactoryImpl(); boolean usesFiles(Files inFile); long countItemsOfUserByMimeType(User inOwner, String ensembleMimeTypes); Music createNewMusic(User theUser, Files inFile); Music createNewMusic(Files inFile, String name, User inOwner, int styleid, int share); Music create(Files inFile, Lang inLang, String name, User inOwner, int styleid, int share, int type); Music findByIdOrUser(long id, User user); Music findNabshareRand(); Music findNabshareRand(Lang inLang); Music findRandomClin(long idCateg, Lang inLang); Music findRandomClin(Lang lang); Music findRandomInBiblio(); Music findByFile(Files inFile); List<Music> findAllForSignature(User inUser); List<Music> findAllByUserIdAndType(User inOwner, String ensembleMimeTypes, int skip, int count); List<Music> findRecentsByType(String ensembleMimeTypes, int count); List<Music> findAllClin(Lang inLang, long idCateg); List<Music> findAllForAlarmClock(Lang inLang); List<Music> findAllForBiblio(int inMusicStyleId); List<Music> findAllNabshareByOwner(User user); List<Music> findAllPersoByUser(User inUser); List<Music> findByStyle(long inMusicStyleId); List<Music> findByTagAndLang(String inTag, Lang inLang); List<Music> findByNabshareCategAndLang(long idNabshareCateg, Lang inLang); List<Music> findByNabshareCategName(String categoryName, int skip, int count); List<Music> findAllStylesByTypeAndLang(long type, Lang inLang, String categoryName, int skip, int count); List<Music> findAllSignatures();  }### Answer:
@Test public void findRecentsByTypeTest() { final User theOwner103 = Factories.USER.find(103L); final User theOwner104 = Factories.USER.find(104L); final User theOwner42 = Factories.USER.find(42L); final int count = 100; final String[] LibrarySelector = { MimeTypes.all.getMimeType(), MimeTypes.audio.getMimeType(), MimeTypes.images.getMimeType() }; for (int j = 0; j < LibrarySelector.length; j++) { Assert.assertEquals(Factories.MUSIC.findRecentsByType(LibrarySelector[j], count).size(), Factories.MUSIC.findAllByUserIdAndType(theOwner103, LibrarySelector[j], 0, count).size() + Factories.MUSIC.findAllByUserIdAndType(theOwner104, LibrarySelector[j], 0, count).size() + Factories.MUSIC.findAllByUserIdAndType(theOwner42, LibrarySelector[j], 0, count).size()); } Assert.assertEquals(Factories.MUSIC.findRecentsByType(LibrarySelector[0], count).get(0).getFile().getCreationDate().toString(), "2008-07-25 00:00:00.0"); }