void () { AnAction copy = newAction("copy"), paste = newAction("paste"), cut = newAction("cut"); copy.getTemplatePresentation().setText("copy"); paste.getTemplatePresentation().setText("paste"); cut.getTemplatePresentation().setText("cut"); List<AnAction> actions = List.of(copy, paste, cut); DataContext ctx = DataContext.EMPTY_CONTEXT; assertEquals( "promoteAll", List.of(copy, paste, cut), UtilsKt.rearrangeByPromotersImpl( actions, ctx, List.of(newPromoter(o -> (List<AnAction>)o)))); assertEquals( "promoteNull", List.of(copy, paste, cut), UtilsKt.rearrangeByPromotersImpl( actions, ctx, List.of(newPromoter(o -> null)))); assertEquals( "promoteNullAction", List.of(copy, paste, cut), UtilsKt.rearrangeByPromotersImpl( actions, ctx, List.of(newPromoter(o -> Collections.singletonList(null))))); assertEquals( "promoteLast", List.of(cut, copy, paste), UtilsKt.rearrangeByPromotersImpl( actions, ctx, List.of(newPromoter(o -> Collections.singletonList(cut))))); assertEquals( "promoteDemote", List.of(cut, paste, copy), UtilsKt.rearrangeByPromotersImpl( actions, ctx, List.of(newPromoter(o -> List.of(cut, paste, copy))))); assertEquals( "promoteDoubleShift", List.of(cut, copy, paste), UtilsKt.rearrangeByPromotersImpl( actions, ctx, List.of(newPromoter(o -> List.of(o.get(1), o.get(2), o.get(0))), newPromoter(o -> List.of(o.get(1), o.get(2), o.get(0)))))); }