From 4b0a8f3e8825f24866b7cfbbd65b2b2ae23f2ec1 Mon Sep 17 00:00:00 2001 From: Fabian Steeg Date: Fri, 12 May 2023 13:55:54 +0200 Subject: [PATCH] Sort alphabetically if `count` is `false` (#300) See https://gitlab.com/oersi/oersi-etl/-/issues/238 --- .../java/org/metafacture/metafix/MetafixStreamAnalyzer.java | 4 ++-- .../java/org/metafacture/metafix/MetafixListPathsTest.java | 4 ++-- .../java/org/metafacture/metafix/MetafixListValuesTest.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/metafix/src/main/java/org/metafacture/metafix/MetafixStreamAnalyzer.java b/metafix/src/main/java/org/metafacture/metafix/MetafixStreamAnalyzer.java index f0c4a9e6..f176b37c 100644 --- a/metafix/src/main/java/org/metafacture/metafix/MetafixStreamAnalyzer.java +++ b/metafix/src/main/java/org/metafacture/metafix/MetafixStreamAnalyzer.java @@ -74,9 +74,9 @@ private TripleCount tripleCount() { private TripleSort tripleSort() { final TripleSort tripleSort = new TripleSort(); - tripleSort.setNumeric(true); + tripleSort.setNumeric(count); tripleSort.setBy(Compare.OBJECT); - tripleSort.setOrder(Order.DECREASING); + tripleSort.setOrder(count ? Order.DECREASING : Order.INCREASING); return tripleSort; } diff --git a/metafix/src/test/java/org/metafacture/metafix/MetafixListPathsTest.java b/metafix/src/test/java/org/metafacture/metafix/MetafixListPathsTest.java index 7f56d389..27c2fcfe 100644 --- a/metafix/src/test/java/org/metafacture/metafix/MetafixListPathsTest.java +++ b/metafix/src/test/java/org/metafacture/metafix/MetafixListPathsTest.java @@ -55,9 +55,9 @@ public void testShouldListPaths() { public void testShouldListPathsNoCount() { lister.setCount(false); verify( - "c.*", + "a", "b.*", - "a"); + "c.*"); } @Test diff --git a/metafix/src/test/java/org/metafacture/metafix/MetafixListValuesTest.java b/metafix/src/test/java/org/metafacture/metafix/MetafixListValuesTest.java index 310bff34..2934a1a8 100644 --- a/metafix/src/test/java/org/metafacture/metafix/MetafixListValuesTest.java +++ b/metafix/src/test/java/org/metafacture/metafix/MetafixListValuesTest.java @@ -97,9 +97,9 @@ public void testShouldListPathsDontCount() { lister = new MetafixListValues("c"); lister.setCount(false); verify( - "cC", "cA", - "cB"); + "cB", + "cC"); } private void processRecord() {