@Test public void testPercentage() { assertEquals(9, DatasetMetricsServiceMyBatis.getPercentage(103, 1078)); assertEquals(9, DatasetMetricsServiceMyBatis.getPercentage(90, 1000)); assertEquals(0, DatasetMetricsServiceMyBatis.getPercentage(1, 1078)); assertEquals(0, DatasetMetricsServiceMyBatis.getPercentage(0, 1078)); assertEquals(99, DatasetMetricsServiceMyBatis.getPercentage(1077, 1078)); assertEquals(100, DatasetMetricsServiceMyBatis.getPercentage(1077, 1077)); }
protected static int getPercentage(int count, int total) { return total > 0 ? count * 100 / total : 0; }
DatasetMetricsServiceMyBatis implements DatasetMetricsService { protected static int getPercentage(int count, int total) { return total > 0 ? count * 100 / total : 0; } }
DatasetMetricsServiceMyBatis implements DatasetMetricsService { protected static int getPercentage(int count, int total) { return total > 0 ? count * 100 / total : 0; } @Inject  DatasetMetricsServiceMyBatis(DatasetMetricsMapper mapper); }
DatasetMetricsServiceMyBatis implements DatasetMetricsService { protected static int getPercentage(int count, int total) { return total > 0 ? count * 100 / total : 0; } @Inject  DatasetMetricsServiceMyBatis(DatasetMetricsMapper mapper); @Override DatasetMetrics get(UUID datasetKey); DatasetMetrics create(UUID datasetKey, Date downloaded); @Override List<DatasetMetrics> list(UUID datasetKey); }
DatasetMetricsServiceMyBatis implements DatasetMetricsService { protected static int getPercentage(int count, int total) { return total > 0 ? count * 100 / total : 0; } @Inject  DatasetMetricsServiceMyBatis(DatasetMetricsMapper mapper); @Override DatasetMetrics get(UUID datasetKey); DatasetMetrics create(UUID datasetKey, Date downloaded); @Override List<DatasetMetrics> list(UUID datasetKey);  }