### Question:
TBRDaoESImp extends BaseDaoESImp implements TBRDao { @Override public double getTBRRatio_PI_BNs_DOT_qBAR(List<TargetingChannel> bns, TargetingChannel q) throws IOException { BoolQueryBuilder tcqb1 = createAndQueryForMultiValuePlusAgeGender(bns); BoolQueryBuilder tcqb2 = createQueryForMultiValuePlusAgeGender(q); tcqb2 = createInvQuery(tcqb2); tcqb1 = tcqb1.must(tcqb2); double v1 = getSumForQuery(tcqb1); if (v1 == 0) { return 0; } tcqb1 = createAndQueryForAgeGender(bns); tcqb2 = createQueryForAgeGender(q); tcqb2 = createInvQuery(tcqb2); tcqb1 = tcqb1.must(tcqb2); double v2 = getSumForQuery(tcqb1); if (v2 == 0) { LOGGER.info("Inconsistent data in TBR"); v2 = 1; } return v1 / v2; } TBRDaoESImp(Properties properties); @Override double getTBRRatio(TargetingChannel targetingChannel); @Override double getTBRRatio_PI_BNs_DOT_qBAR(List<TargetingChannel> bns, TargetingChannel q); @Override double getTBRRatio_PI_TCs(List<TargetingChannel> tcs);  }### Answer:
@Test public void getTBRRatio_PI_BNs_DOT_qBAR() throws IOException { TBRDaoESImp tbrDaoImp = new TBRDaoESImp(DEF_PROP); tbrDaoImp.setESClient(DEF_ESCLI); List<TargetingChannel> bns = new ArrayList(); TargetingChannel bn1 = new TargetingChannel(), bn2 = new TargetingChannel(), bn3 = new TargetingChannel(); bn1.setA(Arrays.asList("3")); bn2.setG(Arrays.asList("g_f")); bn3.setR(Arrays.asList("456")); bns.add(bn1); bns.add(bn2); bns.add(bn3); double res = tbrDaoImp.getTBRRatio_PI_BNs_DOT_qBAR(bns, DEF_TC); assertEquals(1D, res, 0); }