From 239c7341a4ec4e0b2f6bbcf5e62e072bc1e135c0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 May 2026 20:55:23 +0000 Subject: [PATCH 1/3] Fix order-dependent assertions in TestTaxRatesClient The AvaTax API does not guarantee a specific ordering of tax rates in the response. Sort rates by type and rate before asserting to make the integration test resilient to ordering changes. Agent-Logs-Url: https://github.com/killbill/killbill-avatax-plugin/sessions/7990deea-7aa0-49b7-b2a6-fe07995c269a Co-authored-by: xsalefter <510438+xsalefter@users.noreply.github.com> --- .../avatax/client/TestTaxRatesClient.java | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/test/java/org/killbill/billing/plugin/avatax/client/TestTaxRatesClient.java b/src/test/java/org/killbill/billing/plugin/avatax/client/TestTaxRatesClient.java index 08e6126..78332c6 100644 --- a/src/test/java/org/killbill/billing/plugin/avatax/client/TestTaxRatesClient.java +++ b/src/test/java/org/killbill/billing/plugin/avatax/client/TestTaxRatesClient.java @@ -18,7 +18,12 @@ package org.killbill.billing.plugin.avatax.client; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + import org.killbill.billing.plugin.avatax.AvaTaxRemoteTestBase; +import org.killbill.billing.plugin.avatax.client.model.RateModel; import org.killbill.billing.plugin.avatax.client.model.TaxRateResult; import org.testng.Assert; import org.testng.annotations.Test; @@ -41,20 +46,26 @@ private void checkSFRates(final TaxRateResult result) { Assert.assertEquals(result.totalRate, 0.08625); Assert.assertEquals(result.rates.size(), 4); - Assert.assertEquals(result.rates.get(0).rate, 0.0025); - Assert.assertEquals(result.rates.get(0).name, "CA COUNTY TAX"); - Assert.assertEquals(result.rates.get(0).type, "County"); + // Sort rates by type then by rate to avoid order-dependent assertions, + // as the AvaTax API does not guarantee a specific ordering. + final List sorted = new ArrayList<>(result.rates); + sorted.sort(Comparator.comparing((RateModel r) -> r.type) + .thenComparingDouble(r -> r.rate)); + + Assert.assertEquals(sorted.get(0).rate, 0.0025); + Assert.assertEquals(sorted.get(0).name, "CA COUNTY TAX"); + Assert.assertEquals(sorted.get(0).type, "County"); - Assert.assertEquals(result.rates.get(1).rate, 0.06); - Assert.assertEquals(result.rates.get(1).name, "CA STATE TAX"); - Assert.assertEquals(result.rates.get(1).type, "State"); + Assert.assertEquals(sorted.get(1).rate, 0.01); + Assert.assertEquals(sorted.get(1).name, "CA SPECIAL TAX"); + Assert.assertEquals(sorted.get(1).type, "Special"); - Assert.assertEquals(result.rates.get(2).rate, 0.01375); - Assert.assertEquals(result.rates.get(2).name, "CA SPECIAL TAX"); - Assert.assertEquals(result.rates.get(2).type, "Special"); + Assert.assertEquals(sorted.get(2).rate, 0.01375); + Assert.assertEquals(sorted.get(2).name, "CA SPECIAL TAX"); + Assert.assertEquals(sorted.get(2).type, "Special"); - Assert.assertEquals(result.rates.get(3).rate, 0.01); - Assert.assertEquals(result.rates.get(3).name, "CA SPECIAL TAX"); - Assert.assertEquals(result.rates.get(3).type, "Special"); + Assert.assertEquals(sorted.get(3).rate, 0.06); + Assert.assertEquals(sorted.get(3).name, "CA STATE TAX"); + Assert.assertEquals(sorted.get(3).type, "State"); } } From 4336e600db6e9e13291226122fabe096abaa63e8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 20 May 2026 23:50:38 +0000 Subject: [PATCH 2/3] Add killbill-utils as compile dependency to fix OSGi ClassNotFoundException for MultiValueMap The PluginTaxCalculator parent class uses MultiValueMap from killbill-utils, which is declared as provided scope in killbill-base-plugin. Since the OSGi system bundle does not export org.killbill.commons.utils.collect, the plugin bundle must embed killbill-utils to resolve the class at runtime. Agent-Logs-Url: https://github.com/killbill/killbill-avatax-plugin/sessions/7b07bbaf-6f35-4eec-8515-a697760195c4 Co-authored-by: xsalefter <510438+xsalefter@users.noreply.github.com> --- pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pom.xml b/pom.xml index c888f6b..5740bec 100644 --- a/pom.xml +++ b/pom.xml @@ -187,6 +187,10 @@ killbill-metrics-api provided + + org.kill-bill.commons + killbill-utils + org.kill-bill.testing testing-mysql-server From c105350d3604557b900995001a2f83a0f802d186 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 21 May 2026 00:12:30 +0000 Subject: [PATCH 3/3] Change killbill-utils dependency scope to runtime to fix Maven verify The compile scope was causing verification failures. The runtime scope still ensures the classes get embedded in the OSGi bundle (via Embed-Dependency *;scope=compile|runtime;inline=true) while avoiding compile-time conflicts. Agent-Logs-Url: https://github.com/killbill/killbill-avatax-plugin/sessions/afd521cd-c93b-4bcf-a955-362f71546711 Co-authored-by: xsalefter <510438+xsalefter@users.noreply.github.com> --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 5740bec..26df70b 100644 --- a/pom.xml +++ b/pom.xml @@ -190,6 +190,7 @@ org.kill-bill.commons killbill-utils + runtime org.kill-bill.testing