Skip to content

Commit

Permalink
Add test for SorterStrategy class
Browse files Browse the repository at this point in the history
  • Loading branch information
yashpal2104 committed Jan 23, 2025
1 parent 49af843 commit 023d194
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
*/
package jenkins.advancedqueue.sorter;

import static org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.LOGGER;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.CheckReturnValue;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
Expand All @@ -35,6 +32,7 @@
import hudson.model.Queue.LeftItem;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import jenkins.model.Jenkins;

/**
Expand Down Expand Up @@ -69,10 +67,9 @@ public void onStartedItem(@NonNull LeftItem item, float weight) {}
/**
* Called when a {@link hudson.model.Item} leaves the queue and it is canceled.
*/
@CheckReturnValue
public void onCanceledItem(@NonNull LeftItem item) {
if (item.isCancelled()) {

Check warning on line 71 in src/main/java/jenkins/advancedqueue/sorter/SorterStrategy.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 71 is only partially covered, one branch is missing
LOGGER.info("Item is cancelled: " + item);
Logger.getLogger("Item is cancelled: " + item);
}
}
;
Expand Down Expand Up @@ -109,7 +106,6 @@ public static SorterStrategyDescriptor getSorterStrategy(String key) {
return null;
}

@CheckForNull
public static SorterStrategy getPrioritySorterStrategy(SorterStrategyDescriptor sorterStrategy) {
ExtensionList<SorterStrategy> all = all();
for (SorterStrategy prioritySorterStrategy : all) {
Expand Down

0 comments on commit 023d194

Please sign in to comment.