### Question:
CostComparator { public int compare(Session session, PlanCostEstimate left, PlanCostEstimate right) { requireNonNull(session, "session is null"); requireNonNull(left, "left is null"); requireNonNull(right, "right is null"); checkArgument(!left.hasUnknownComponents() && !right.hasUnknownComponents(), "cannot compare unknown costs"); double leftCost = left.getCpuCost() * cpuWeight + left.getMaxMemory() * memoryWeight + left.getNetworkCost() * networkWeight; double rightCost = right.getCpuCost() * cpuWeight + right.getMaxMemory() * memoryWeight + right.getNetworkCost() * networkWeight; return Double.compare(leftCost, rightCost); } @Inject  CostComparator(FeaturesConfig featuresConfig); @VisibleForTesting  CostComparator(double cpuWeight, double memoryWeight, double networkWeight); Ordering<PlanCostEstimate> forSession(Session session); int compare(Session session, PlanCostEstimate left, PlanCostEstimate right);  }### Answer:
@Test public void testUnknownCost() { CostComparator costComparator = new CostComparator(1.0, 1.0, 1.0); Session session = testSessionBuilder().build(); assertThrows(IllegalArgumentException.class, () -> costComparator.compare(session, PlanCostEstimate.zero(), PlanCostEstimate.unknown())); assertThrows(IllegalArgumentException.class, () -> costComparator.compare(session, PlanCostEstimate.unknown(), PlanCostEstimate.zero())); assertThrows(IllegalArgumentException.class, () -> costComparator.compare(session, PlanCostEstimate.unknown(), PlanCostEstimate.unknown())); }