### Question:
ThresholdFactory { public static ThresholdSha256Fulfillment twoOfTwoFulfillment( final Fulfillment fulfillment1, final Fulfillment fulfillment2 ) { Objects.requireNonNull(fulfillment1, "fulfillment1 must not be null!"); Objects.requireNonNull(fulfillment2, "fulfillment2 must not be null!"); return constructMOfNFulfillment(2, 2, Collections.emptyList(), Stream.of(fulfillment1, fulfillment2).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 twoOfTwoFulfillmentWithFirstNull() { try { ThresholdFactory.twoOfTwoFulfillment(null, subfulfillment2); } catch (NullPointerException e) { assertThat(e.getMessage(), is("fulfillment1 must not be null!")); throw e; } }
@Test(expected = NullPointerException.class) public void twoOfTwoFulfillmentWithSecondNull() { try { ThresholdFactory.twoOfTwoFulfillment(subfulfillment1, null); } catch (NullPointerException e) { assertThat(e.getMessage(), is("fulfillment2 must not be null!")); throw e; } }
@Test public void twoOfTwoFulfillment() { final ThresholdSha256Condition thresholdCondition = ThresholdSha256Condition.from( 2, Lists.newArrayList(subcondition1, subcondition2) ); assertThat(thresholdCondition.getSubtypes().contains(CryptoConditionType.PREIMAGE_SHA256), is(true)); assertThat(thresholdCondition.getSubtypes().size(), is(1)); assertThat(thresholdCondition.getFingerprintBase64Url(), is("vo0OYr-3kha9LN85LY56wIrBaBt0MH_iqlqPiKO4t_U")); assertThat(thresholdCondition.getCost(), is(2118L)); assertThat(thresholdCondition.getType(), is(CryptoConditionType.THRESHOLD_SHA256)); { final ThresholdSha256Fulfillment fulfillment = ThresholdFactory .twoOfTwoFulfillment(subfulfillment1, subfulfillment2); assertThat(fulfillment.verify(thresholdCondition, "".getBytes()), is(true)); } { final ThresholdSha256Fulfillment fulfillment = ThresholdFactory .twoOfTwoFulfillment(subfulfillment2, subfulfillment1); assertThat(fulfillment.verify(thresholdCondition, "".getBytes()), is(true)); } { final ThresholdSha256Fulfillment fulfillment1 = ThresholdFactory .twoOfTwoFulfillment(subfulfillment1, subfulfillment3); assertThat(fulfillment1.verify(thresholdCondition, "".getBytes()), is(false)); } { final ThresholdSha256Fulfillment fulfillment1 = ThresholdFactory .twoOfTwoFulfillment(subfulfillment1, subfulfillment1); assertThat(fulfillment1.verify(thresholdCondition, "".getBytes()), is(false)); } }