Skip to content

Commit

Permalink
Merge branch 'beta' into latest-codegen-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
prathmesh-stripe authored Oct 29, 2024
2 parents 401eaf7 + 347f1fa commit 3d2c6a3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/stripe/Stripe.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public static void addBetaVersion(String betaName, String betaVersion) {
stripeVersionWithBetaHeaders, betaName));
}

stripeVersionWithBetaHeaders = String.format("%s; %s=%s", stripeVersion, betaName, betaVersion);
stripeVersionWithBetaHeaders =
String.format("%s; %s=%s", stripeVersionWithBetaHeaders, betaName, betaVersion);
}

// For testing only. This is not part of a stable API and could change in non-major versions.
Expand Down
19 changes: 19 additions & 0 deletions src/test/java/com/stripe/functional/StripeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,23 @@ public void testAddBetaVersion() {
Stripe.addBetaVersion("super_cool_beta", "v1");
});
}

@Test
public void testAddSecondBetaVersion() {
Stripe.addBetaVersion("super_cool_beta", "v1");
assertNotEquals(Stripe.stripeVersion, Stripe.API_VERSION + "; super_cool_beta=v1");
assertEquals(
Stripe.API_VERSION + "; super_cool_beta=v1", Stripe.getStripeVersionWithBetaHeaders());

Stripe.addBetaVersion("super_hot_beta", "v2");
assertNotEquals(Stripe.stripeVersion, Stripe.API_VERSION + "; super_cool_beta=v1");
assertEquals(
Stripe.API_VERSION + "; super_cool_beta=v1; super_hot_beta=v2",
Stripe.getStripeVersionWithBetaHeaders());
assertThrows(
RuntimeException.class,
() -> {
Stripe.addBetaVersion("super_hot_beta", "v1");
});
}
}

0 comments on commit 3d2c6a3

Please sign in to comment.