@Test public void testGetNewParameterNameWithExistingParameters() { final InformationItem informationItem1 = new InformationItem(); function.getFormalParameter().add(informationItem1); informationItem1.getName().setValue("parameter"); final InformationItem informationItem2 = new InformationItem(); function.getFormalParameter().add(informationItem2); informationItem2.getName().setValue(FunctionDefaultValueUtilities.getNewParameterName(function)); assertThat(informationItem2.getName().getValue()).isEqualTo(FunctionDefaultValueUtilities.PREFIX + "1"); }
public static String getNewParameterName(final FunctionDefinition function) { return PREFIX + DefaultValueUtilities.getMaxUnusedIndex(function.getFormalParameter().stream() .filter(informationItem -> informationItem != null) .map(InformationItem::getName) .filter(name -> name != null) .map(Name::getValue) .collect(Collectors.toList()), PREFIX); }
FunctionDefaultValueUtilities { public static String getNewParameterName(final FunctionDefinition function) { return PREFIX + DefaultValueUtilities.getMaxUnusedIndex(function.getFormalParameter().stream() .filter(informationItem -> informationItem != null) .map(InformationItem::getName) .filter(name -> name != null) .map(Name::getValue) .collect(Collectors.toList()), PREFIX); } }
FunctionDefaultValueUtilities { public static String getNewParameterName(final FunctionDefinition function) { return PREFIX + DefaultValueUtilities.getMaxUnusedIndex(function.getFormalParameter().stream() .filter(informationItem -> informationItem != null) .map(InformationItem::getName) .filter(name -> name != null) .map(Name::getValue) .collect(Collectors.toList()), PREFIX); }  }
FunctionDefaultValueUtilities { public static String getNewParameterName(final FunctionDefinition function) { return PREFIX + DefaultValueUtilities.getMaxUnusedIndex(function.getFormalParameter().stream() .filter(informationItem -> informationItem != null) .map(InformationItem::getName) .filter(name -> name != null) .map(Name::getValue) .collect(Collectors.toList()), PREFIX); }  static String getNewParameterName(final FunctionDefinition function); }
FunctionDefaultValueUtilities { public static String getNewParameterName(final FunctionDefinition function) { return PREFIX + DefaultValueUtilities.getMaxUnusedIndex(function.getFormalParameter().stream() .filter(informationItem -> informationItem != null) .map(InformationItem::getName) .filter(name -> name != null) .map(Name::getValue) .collect(Collectors.toList()), PREFIX); }  static String getNewParameterName(final FunctionDefinition function); static final String PREFIX; }