### Question:
CommitDao extends Dao { public List<Commit> getByModule( String moduleId ) { LOG.debug( "moduleId: {}", moduleId ); SearchResponse response = getRequest( DAO_INDEX_KEY, DAO_TYPE_KEY ) .setQuery( termQuery( "moduleId", moduleId ) ) .setSize( MAX_RESULT_SIZE ) .execute().actionGet(); TreeMap<Date, Commit> commitMap = new TreeMap<Date, Commit>(); for ( SearchHit hit : response.getHits().hits() ) { Map<String, Object> json = hit.getSource(); BasicCommit commit = new BasicCommit( hit.getId(), Util.getString( json, "moduleId" ), Util.getString( json, "md5" ), Util.toDate( Util.getString(json, "createTime" ) ), Util.getString( json, "runnerPath" ) ); commitMap.put( commit.getCreateTime(), commit ); } ArrayList<Commit> commitList = new ArrayList<Commit>( commitMap.values() ); LOG.debug( "commits: {}", commitList.size() ); return commitList; } @Inject  CommitDao( IElasticSearchClient elasticSearchClient ); boolean save( Commit commit ); List<Commit> getByModule( String moduleId ); static final String DAO_INDEX_KEY; static final String DAO_TYPE_KEY; }### Answer:
@Test public void testGetByModule() { LOG.info( "\n===CommitDaoTest.testGetByModule===\n" ); List<Commit> list = ESSuiteTest.commitDao.getByModule( ESSuiteTest.MODULE_ID_2 ); for ( Commit commit : list ) { LOG.info( commit.toString() ); } assertEquals( 2, list.size() ); }
@Test public void testGet() { LOG.info( "\n===CommitDaoTest.testGet===\n" ); Commit commit = ESSuiteTest.commitDao.getByModule( ESSuiteTest.MODULE_ID_1 ).get( 0 ); LOG.info( commit.toString() ); assertEquals( ESSuiteTest.COMMIT_ID_1, commit.getId() ); }