@Test() public void testGetCounterMerticValue(){ TotalTransactionsHandler ss = new TotalTransactionsHandler(); MockUp<RestCommunicationHandler> rch = new MockUp<com.tmobile.kardio.surveiller.main.RestCommunicationHandler>() { @Mock public String getResponse(String urlStr, Boolean doAuth,String authType, String encodedAuth){ return mcData.mockSingleVauleJson(); } }; MockUp<DBQueryUtil> dqu = new MockUp<com.tmobile.kardio.surveiller.util.DBQueryUtil>() { @Mock public float getTotalTransaction(int envCountId){ return (float) 5.00; } }; try { ss.getCounterMerticValue(mcData.getMockedCounterDetails(), null); } catch (Exception e) { e.printStackTrace(); } rch.tearDown(); rch = new MockUp<com.tmobile.kardio.surveiller.main.RestCommunicationHandler>() { @Mock public String getResponse(String urlStr, Boolean doAuth, String authType, String encodedAuth){ return mcData.mockValueNodeEmptyPromJson(); } }; boolean thrown = false; try { ss.getCounterMerticValue(mcData.getMockedCounterDetails(), null); } catch (Exception e) { thrown = true; } assertTrue(thrown); rch.tearDown(); rch = new MockUp<com.tmobile.kardio.surveiller.main.RestCommunicationHandler>() { @Mock public String getResponse(String urlStr, Boolean doAuth, String authType, String encodedAuth){ String jsonString = mcData.mockDataNodeEmptyPromJson(); return jsonString; } }; boolean emptyDataException = false; try { ss.getCounterMerticValue(mcData.getMockedCounterDetails(), null); } catch (Exception e) { emptyDataException = true; } assertTrue(emptyDataException); rch.tearDown(); rch = new MockUp<com.tmobile.kardio.surveiller.main.RestCommunicationHandler>() { @Mock public String getResponse(String urlStr, Boolean doAuth, String authType, String encodedAuth){ return mcData.mockDataStatusFailedPromJson(); } }; boolean statusFailedException = false; try { ss.getCounterMerticValue(mcData.getMockedCounterDetails(), null); } catch (Exception e) { statusFailedException = true; } assertTrue(statusFailedException); rch.tearDown(); rch = new MockUp<com.tmobile.kardio.surveiller.main.RestCommunicationHandler>() { @Mock public String getResponse(String urlStr, Boolean doAuth, String authType, String encodedAuth){ return mcData.mockDataNodeNullPromJson(); } }; boolean resultEmptyException = false; try { ss.getCounterMerticValue(mcData.getMockedCounterDetails(), null); } catch (Exception e) { resultEmptyException = true; } assertTrue(resultEmptyException); rch.tearDown(); rch = new MockUp<com.tmobile.kardio.surveiller.main.RestCommunicationHandler>() { @Mock public String getResponse(String urlStr, Boolean doAuth, String authType, String encodedAuth){ return mcData.mockStatusNullPromJson(); } }; boolean statusNullException = false; try { ss.getCounterMerticValue(mcData.getMockedCounterDetails(), null); } catch (Exception e) { statusNullException = true; } assertTrue(statusNullException); rch.tearDown(); }
@Override public float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails) throws Exception { float totalTrans = DBQueryUtil.getTotalTransaction(counterDetails.getEnvironmentCounterId()); float metricValue = getMetricValue(counterDetails); totalTrans += metricValue; return totalTrans; }
TotalTransactionsHandler extends CounterMetricHandler { @Override public float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails) throws Exception { float totalTrans = DBQueryUtil.getTotalTransaction(counterDetails.getEnvironmentCounterId()); float metricValue = getMetricValue(counterDetails); totalTrans += metricValue; return totalTrans; } }
TotalTransactionsHandler extends CounterMetricHandler { @Override public float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails) throws Exception { float totalTrans = DBQueryUtil.getTotalTransaction(counterDetails.getEnvironmentCounterId()); float metricValue = getMetricValue(counterDetails); totalTrans += metricValue; return totalTrans; }  }
TotalTransactionsHandler extends CounterMetricHandler { @Override public float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails) throws Exception { float totalTrans = DBQueryUtil.getTotalTransaction(counterDetails.getEnvironmentCounterId()); float metricValue = getMetricValue(counterDetails); totalTrans += metricValue; return totalTrans; }  @Override Logger getLogger(); @Override float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails); }
TotalTransactionsHandler extends CounterMetricHandler { @Override public float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails) throws Exception { float totalTrans = DBQueryUtil.getTotalTransaction(counterDetails.getEnvironmentCounterId()); float metricValue = getMetricValue(counterDetails); totalTrans += metricValue; return totalTrans; }  @Override Logger getLogger(); @Override float getCounterMerticValue(CounterDetailVO counterDetails, List<CounterDetailVO> listCounterDetails);  }