public static String generateApplyOrDefault(
      final String inputCode,
      final String mapperCode,
      final String defaultValueCode,
      final Class<?> returnType
  ) {
    return "(" + returnType.getSimpleName() + ")" + NullSafe.class.getSimpleName()
        + ".applyOrDefault(" + inputCode + "," + mapperCode + ", " + defaultValueCode + ")";
  }
@Test
  public void shouldGenerateApplyOrDefault() {
    // Given:
    final String mapperCode = LambdaUtil
        .toJavaCode("val", Long.class, "val.longValue() + 1");

    // When:
    final String javaCode = NullSafe
        .generateApplyOrDefault("arguments.get(\"input\")", mapperCode, "99L", Long.class);

    // Then:
    final Evaluator evaluator = CodeGenTestUtil.cookCode(javaCode, Long.class);
    assertThat(evaluator.evaluate("input", 10L), is(11L));
    assertThat(evaluator.evaluate("input", null), is(99L));
  }