diff options
author | David Srbecky <dsrbecky@google.com> | 2021-02-24 21:20:54 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-02-24 21:20:54 +0000 |
commit | 138b64feb682b90292d36002f3aff9869d6a9e4b (patch) | |
tree | fb060599e56a1ce3ccfa4cacd193406f14ba84db /src/main/java/org/junit/runner/manipulation/Orderer.java | |
parent | 99022df227f5503b68838d97e0a6b3fa5f558f1b (diff) | |
parent | 91c5e5ff9d71ebc00818b310c09b175016c36dc2 (diff) | |
download | junit-138b64feb682b90292d36002f3aff9869d6a9e4b.tar.gz |
Merge changes from topic "revert-1601635-AIQYZOHWTP" am: 565f36d281 am: 23e304a839 am: 91c5e5ff9d
Original change: https://android-review.googlesource.com/c/platform/external/junit/+/1605377
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: Iaa51f5a85f96ec87a01eff9bc98e2274fc5a97dd
Diffstat (limited to 'src/main/java/org/junit/runner/manipulation/Orderer.java')
-rw-r--r-- | src/main/java/org/junit/runner/manipulation/Orderer.java | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/main/java/org/junit/runner/manipulation/Orderer.java b/src/main/java/org/junit/runner/manipulation/Orderer.java deleted file mode 100644 index eb13054..0000000 --- a/src/main/java/org/junit/runner/manipulation/Orderer.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.junit.runner.manipulation; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.junit.runner.Description; - -/** - * Orders tests. - * - * @since 4.13 - */ -public final class Orderer { - private final Ordering ordering; - - Orderer(Ordering delegate) { - this.ordering = delegate; - } - - /** - * Orders the descriptions. - * - * @return descriptions in order - */ - public List<Description> order(Collection<Description> descriptions) - throws InvalidOrderingException { - List<Description> inOrder = ordering.orderItems( - Collections.unmodifiableCollection(descriptions)); - if (!ordering.validateOrderingIsCorrect()) { - return inOrder; - } - - Set<Description> uniqueDescriptions = new HashSet<Description>(descriptions); - if (!uniqueDescriptions.containsAll(inOrder)) { - throw new InvalidOrderingException("Ordering added items"); - } - Set<Description> resultAsSet = new HashSet<Description>(inOrder); - if (resultAsSet.size() != inOrder.size()) { - throw new InvalidOrderingException("Ordering duplicated items"); - } else if (!resultAsSet.containsAll(uniqueDescriptions)) { - throw new InvalidOrderingException("Ordering removed items"); - } - - return inOrder; - } - - /** - * Order the tests in <code>target</code>. - * - * @throws InvalidOrderingException if ordering does something invalid (like remove or add - * children) - */ - public void apply(Object target) throws InvalidOrderingException { - if (target instanceof Orderable) { - Orderable orderable = (Orderable) target; - orderable.order(this); - } - } -} |