diff --git a/src/main/java/uk/gov/pay/card/resources/CardIdResource.java b/src/main/java/uk/gov/pay/card/resources/CardIdResource.java index a2c83750..309ff1f6 100644 --- a/src/main/java/uk/gov/pay/card/resources/CardIdResource.java +++ b/src/main/java/uk/gov/pay/card/resources/CardIdResource.java @@ -45,9 +45,9 @@ public Response cardInformation(@NotNull @Valid CardInformationRequest cardInfor .build(); } - private Optional getCardNumber(String prefix) { + private Optional getCardNumber(String cardNumber) { try { - return Optional.of(Long.valueOf(prefix)); + return Optional.of(Long.valueOf(cardNumber)); } catch (NumberFormatException e) { logger.info("Received card number that cannot be parsed into long"); return Optional.empty(); diff --git a/src/test/java/uk/gov/pay/card/bench/RangeSetCardInformationStoreBenchmark.java b/src/test/java/uk/gov/pay/card/bench/RangeSetCardInformationStoreBenchmark.java index 1d815081..89165316 100644 --- a/src/test/java/uk/gov/pay/card/bench/RangeSetCardInformationStoreBenchmark.java +++ b/src/test/java/uk/gov/pay/card/bench/RangeSetCardInformationStoreBenchmark.java @@ -24,6 +24,18 @@ * - Change the name of the file to load in this benchmark (in the setup()) method. * - You would have to replace the existing test card prefixes with some new prefixes. * - And then run the benchmark. + * + * The Benchmark outputs something like the following: + * + * Benchmark (cardIdPrefix) Mode Cnt Score Error Units + * RangeSetCardInformationStoreBenchmark.runBenchmark 511226661120000000 avgt 20 0.145 ± 0.001 us/op + * RangeSetCardInformationStoreBenchmark.runBenchmark 511226661130000000 avgt 20 0.142 ± 0.004 us/op + * RangeSetCardInformationStoreBenchmark.runBenchmark 511226661140000000 avgt 20 0.146 ± 0.002 us/op + * etc + * + * This means the test card 511226661120000000 took 0.145 microseconds to run on average over 20 iterations. + * Assuming that the results are normally distributed, one would expect that the "true" execution time for + * that method has a 99.9% probability to be somewhere between 0.145± 0.001 microseconds. */ @State(Scope.Benchmark) public class RangeSetCardInformationStoreBenchmark {