### Question:
MusicFactoryImpl extends RecordFactoryImpl<Music, MusicImpl> implements MusicFactory { public List<Music> findByNabshareCategName(String categoryName, int skip, int count) { final String[] inJoinTables = new String[] { "categ" }; final String condition = "music_share = categ_id and categ_type = ?"; final List<Music> theResult = findAll(inJoinTables, condition, Arrays.asList(new Object[] { categoryName }), "music_name", skip, count); return theResult; } 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 findByNabshareCategNameAndLang() { final Lang frLang = Factories.LANG.findByIsoCode("fr-FR"); final Long frId = frLang.getId(); List<Music> listMusic = Factories.MUSIC.findByNabshareCategName("clin bonjour", 0, 10); Assert.assertEquals(6, listMusic.size()); for (final Music inMusic : listMusic) { Assert.assertEquals(frId, (Long) inMusic.getMusic_lang()); Assert.assertTrue(inMusic.getMusic_name().startsWith("clin bonjour")); } listMusic = Factories.MUSIC.findByNabshareCategName("mp3 signature", 0, 10); Assert.assertEquals(2, listMusic.size()); for (final Music inMusic : listMusic) { Assert.assertEquals(frId, (Long) inMusic.getMusic_lang()); Assert.assertTrue(inMusic.getMusic_name().startsWith("mp3 signature")); } }