DiffAnalyticsRowMapper implements RowMapper<DiffAnalytics> { @Override public DiffAnalytics mapRow(ResultSet rs, int rowNum) throws SQLException { String experimentAccession = rs.getString(DiffAnalyticsQueryBuilder.EXPERIMENT); String contrastId = rs.getString(DiffAnalyticsQueryBuilder.CONTRASTID); Contrast contrast = contrastTrader.getContrast(experimentAccession, contrastId); DifferentialExpression expression = buildDifferentialExpression( rs.getDouble(DiffAnalyticsQueryBuilder.PVALUE), rs.getDouble(DiffAnalyticsQueryBuilder.LOG_2_FOLD), rs.getString(DiffAnalyticsQueryBuilder.TSTAT)); return new DiffAnalytics( rs.getString(DiffAnalyticsQueryBuilder.IDENTIFIER), rs.getString(DiffAnalyticsQueryBuilder.NAME), experimentAccession, expression, rs.getString(DiffAnalyticsQueryBuilder.ORGANISM), contrast); } @Inject  DiffAnalyticsRowMapper(ContrastTrader contrastTrader); @Override DiffAnalytics mapRow(ResultSet rs, int rowNum);  }
@Test public void testMapRow() throws Exception { DiffAnalytics expression = subject.mapRow(resultSetMock, 1); MatcherAssert.assertThat(expression.getBioentityId(), Is.is("id1")); MatcherAssert.assertThat(expression.getExperimentAccession(), Is.is("e1")); MatcherAssert.assertThat(expression.getSpecies(), Is.is("org1")); DifferentialExpression value = new MicroarrayExpression(0.0001, -1.1, 1.1); MatcherAssert.assertThat(expression.getExpression(), Is.is(value)); }