### Question:
ThresholdLowerer { public void lowerThreshold(int rhsAttr, double threshold) { MDElement rhs = new MDElementImpl(rhsAttr, threshold); lowerThreshold(rhs); }  void lowerThreshold(int rhsAttr, double threshold); void lowerThreshold(MDElement rhs, boolean minimal);  }### Answer:
@Test public void testMinimal() { int rhsAttr = 0; double threshold = 0.1; ThresholdLowerer task = new ThresholdLowerer(latticeMd); when(Boolean.valueOf(latticeMd.wouldBeMinimal(new MDElementImpl(rhsAttr, threshold)))).thenReturn(Boolean.TRUE); when(latticeMd.getLhs()).thenReturn(lhs); task.lowerThreshold(rhsAttr, threshold); verify(latticeMd).setRhs(rhsAttr, threshold); }
@Test public void testNotMinimal() { int rhsAttr = 0; double threshold = 0.1; ThresholdLowerer task = new ThresholdLowerer(latticeMd); when(Boolean.valueOf(latticeMd.wouldBeMinimal(new MDElementImpl(rhsAttr, threshold)))).thenReturn(Boolean.FALSE); when(latticeMd.getLhs()).thenReturn(lhs); task.lowerThreshold(rhsAttr, threshold); verify(latticeMd).removeRhs(rhsAttr); verify(latticeMd, never()).setRhs(rhsAttr, threshold); }
@Test public void testTrivial() { int rhsAttr = 0; double threshold = 0.1; ThresholdLowerer task = new ThresholdLowerer(latticeMd); when(Boolean.valueOf(latticeMd.wouldBeMinimal(new MDElementImpl(rhsAttr, threshold)))).thenReturn(Boolean.TRUE); when(latticeMd.getLhs()).thenReturn(lhs); when(Double.valueOf(lhs.getOrDefault(0))).thenReturn(Double.valueOf(0.1)); task.lowerThreshold(rhsAttr, threshold); verify(latticeMd).removeRhs(rhsAttr); verify(latticeMd, never()).setRhs(rhsAttr, threshold); }