@Test public void testGetNewContextEntryName() { final ContextEntry contextEntry1 = new ContextEntry() {{ setVariable(new InformationItem()); }}; context.getContextEntry().add(contextEntry1); contextEntry1.getVariable().getName().setValue(ContextEntryDefaultValueUtilities.getNewContextEntryName(context)); assertThat(contextEntry1.getVariable().getName().getValue()).isEqualTo(ContextEntryDefaultValueUtilities.PREFIX + "1"); final ContextEntry contextEntry2 = new ContextEntry() {{ setVariable(new InformationItem()); }}; context.getContextEntry().add(contextEntry2); contextEntry2.getVariable().getName().setValue(ContextEntryDefaultValueUtilities.getNewContextEntryName(context)); assertThat(contextEntry2.getVariable().getName().getValue()).isEqualTo(ContextEntryDefaultValueUtilities.PREFIX + "2"); }
public static String getNewContextEntryName(final Context context) { return PREFIX + DefaultValueUtilities.getMaxUnusedIndex(context.getContextEntry().stream() .map(ContextEntry::getVariable) .filter(informationItem -> informationItem != null) .map(InformationItem::getName) .filter(name -> name != null) .map(Name::getValue) .collect(Collectors.toList()), PREFIX); }
ContextEntryDefaultValueUtilities { public static String getNewContextEntryName(final Context context) { return PREFIX + DefaultValueUtilities.getMaxUnusedIndex(context.getContextEntry().stream() .map(ContextEntry::getVariable) .filter(informationItem -> informationItem != null) .map(InformationItem::getName) .filter(name -> name != null) .map(Name::getValue) .collect(Collectors.toList()), PREFIX); } }
ContextEntryDefaultValueUtilities { public static String getNewContextEntryName(final Context context) { return PREFIX + DefaultValueUtilities.getMaxUnusedIndex(context.getContextEntry().stream() .map(ContextEntry::getVariable) .filter(informationItem -> informationItem != null) .map(InformationItem::getName) .filter(name -> name != null) .map(Name::getValue) .collect(Collectors.toList()), PREFIX); }  }
ContextEntryDefaultValueUtilities { public static String getNewContextEntryName(final Context context) { return PREFIX + DefaultValueUtilities.getMaxUnusedIndex(context.getContextEntry().stream() .map(ContextEntry::getVariable) .filter(informationItem -> informationItem != null) .map(InformationItem::getName) .filter(name -> name != null) .map(Name::getValue) .collect(Collectors.toList()), PREFIX); }  static String getNewContextEntryName(final Context context); }
ContextEntryDefaultValueUtilities { public static String getNewContextEntryName(final Context context) { return PREFIX + DefaultValueUtilities.getMaxUnusedIndex(context.getContextEntry().stream() .map(ContextEntry::getVariable) .filter(informationItem -> informationItem != null) .map(InformationItem::getName) .filter(name -> name != null) .map(Name::getValue) .collect(Collectors.toList()), PREFIX); }  static String getNewContextEntryName(final Context context); static final String PREFIX; }