### Question:
TBRDaoESImp extends BaseDaoESImp implements TBRDao { @Override public double getTBRRatio(TargetingChannel targetingChannel) throws ESConnectionException { double ratio = 0; if (!targetingChannel.hasMultiValues()) { return 1; } try { BoolQueryBuilder boolQueryBuilder = createBoolQueryForTBR(targetingChannel, false); double queryCountResult = getSumForQuery(boolQueryBuilder); if (queryCountResult == 0) { ratio = 0; } else { boolQueryBuilder = createBoolQueryForTBR(targetingChannel, true); double total = getSumForQuery(boolQueryBuilder); if (total != 0) { ratio = queryCountResult / total; } } } catch (IOException e) { LOGGER.error(e.getMessage()); throw new ESConnectionException(e.getMessage()); } LOGGER.info("tbr ratio={}", ratio); return ratio; } 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() throws ESConnectionException { TBRDaoESImp tbrDaoImp = new TBRDaoESImp(DEF_PROP); tbrDaoImp.setESClient(DEF_ESCLI); double res = tbrDaoImp.getTBRRatio(DEF_TC); assertEquals(res, 1D, 0); TargetingChannel tc = new TargetingChannel(); tc.setAus(Arrays.asList("123")); res = tbrDaoImp.getTBRRatio(tc); assertEquals(res, 0D, 0); }