From 67e4fd9027a255490c385cdbe9ec32eba2d1013c Mon Sep 17 00:00:00 2001 From: Yash Pal Date: Sat, 11 Jan 2025 17:05:36 +0530 Subject: [PATCH] refactor the onCanceledItem method for test --- .../jenkins/advancedqueue/sorter/SorterStrategy.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/jenkins/advancedqueue/sorter/SorterStrategy.java b/src/main/java/jenkins/advancedqueue/sorter/SorterStrategy.java index b06c7e2e..9706e551 100644 --- a/src/main/java/jenkins/advancedqueue/sorter/SorterStrategy.java +++ b/src/main/java/jenkins/advancedqueue/sorter/SorterStrategy.java @@ -66,7 +66,15 @@ public void onStartedItem(@NonNull LeftItem item, float weight) {} /** * Called when a {@link hudson.model.Item} leaves the queue and it is canceled. */ - public void onCanceledItem(@NonNull LeftItem item) {} + public void onCanceledItem(@NonNull LeftItem item) { + if (item.isCancelled()) { + ExtensionList all = all(); + for (SorterStrategy prioritySorterStrategy : all) { + SorterStrategyDescriptor descriptor = prioritySorterStrategy.getDescriptor(); + descriptor.getId(); + } + } + } ; /**