### Question:
ThresholdFactory { public static ThresholdSha256Condition twoOfTwoCondition( final Condition condition1, final Condition condition2 ) { Objects.requireNonNull(condition1, "condition1 must not be null!"); Objects.requireNonNull(condition2, "condition2 must not be null!"); return constructMOfNCondition( 2, 2, Stream.of(condition1, condition2).collect(Collectors.toList()) ); }  static ThresholdSha256Condition oneOfTwoCondition(
      final Condition condition1, final Condition condition2
  ); static ThresholdSha256Condition twoOfTwoCondition(
      final Condition condition1, final Condition condition2
  ); static ThresholdSha256Condition constructMOfNCondition(
      final int thresholdM, int numSubCondtionsN, final List<Condition> subconditions
  ); static ThresholdSha256Fulfillment oneOfTwoFulfillment(
      final Fulfillment fulfillment, final Condition condition
  ); static ThresholdSha256Fulfillment twoOfTwoFulfillment(
      final Fulfillment fulfillment1, final Fulfillment fulfillment2
  ); static ThresholdSha256Fulfillment constructMOfNFulfillment(
      final int thresholdM, int totalN,
      final List<Condition> subconditions, final List<Fulfillment> subfulfillments
  );  }### Answer:
@Test(expected = NullPointerException.class) public void twoOfTwoConditionWithNullFirst() { try { ThresholdFactory.twoOfTwoCondition(null, subcondition2); } catch (NullPointerException e) { assertThat(e.getMessage(), is("condition1 must not be null!")); throw e; } }
@Test(expected = NullPointerException.class) public void twoOfTwoConditionWithSecondNull() { try { ThresholdFactory.twoOfTwoCondition(subcondition1, null); } catch (NullPointerException e) { assertThat(e.getMessage(), is("condition2 must not be null!")); throw e; } }
@Test public void twoOfTwoCondition() { final ThresholdSha256Fulfillment thresholdFulfillment = ThresholdSha256Fulfillment.from( Lists.newArrayList(), Lists.newArrayList(subfulfillment1, subfulfillment2) ); assertThat(thresholdFulfillment.getSubconditions().size(), is(0)); assertThat(thresholdFulfillment.getSubfulfillments().size(), is(2)); { final ThresholdSha256Condition thresholdCondition = ThresholdFactory .twoOfTwoCondition(subcondition1, subcondition2); assertThat(thresholdFulfillment.verify(thresholdCondition, "".getBytes()), is(true)); } { final ThresholdSha256Condition thresholdCondition = ThresholdFactory .twoOfTwoCondition(subcondition1, subcondition1); assertThat(thresholdFulfillment.verify(thresholdCondition, "".getBytes()), is(false)); } { final ThresholdSha256Condition thresholdCondition = ThresholdFactory .twoOfTwoCondition(subcondition2, subcondition2); assertThat(thresholdFulfillment.verify(thresholdCondition, "".getBytes()), is(false)); } }