Skip to content

Commit

Permalink
Make constructors package private
Browse files Browse the repository at this point in the history
  • Loading branch information
sualeh committed Apr 22, 2022
1 parent a1c2baf commit 84dbe04
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import static java.util.Objects.requireNonNull;

public final class AccountNumberSecure implements AccountNumber {
final class AccountNumberSecure implements AccountNumber {

private static final long serialVersionUID = 2002490292247684624L;

Expand All @@ -26,7 +26,7 @@ public final class AccountNumberSecure implements AccountNumber {
*
* @param accountNumber Account number with metadata
*/
public AccountNumberSecure(final AccountNumber accountNumber) {
AccountNumberSecure(final AccountNumber accountNumber) {
this(
requireNonNull(accountNumber, "No account number provided").getCardBrand(),
accountNumber.getMajorIndustryIdentifier(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static us.fatehi.creditcardnumber.AccountNumbers.completeAccountNumber;
import static us.fatehi.creditcardnumber.AccountNumbers.secureAccountNumber;
import static us.fatehi.test.utility.AccountNumbersTestUtility.equivalent;

import java.security.Key;
Expand All @@ -23,7 +24,6 @@
import org.junit.jupiter.api.Test;

import us.fatehi.creditcardnumber.AccountNumber;
import us.fatehi.creditcardnumber.AccountNumberSecure;
import us.fatehi.creditcardnumber.AccountNumbers;
import us.fatehi.creditcardnumber.CardBrand;
import us.fatehi.creditcardnumber.MajorIndustryIdentifier;
Expand Down Expand Up @@ -91,7 +91,7 @@ public void pan1() {
assertThat(pan != securePan1, is(true));
assertThat(equivalent(pan, securePan1), is(true));

final AccountNumber securePan2 = new AccountNumberSecure(pan);
final AccountNumber securePan2 = secureAccountNumber(pan);
assertThat(pan != securePan2, is(true));
assertThat(equivalent(pan, securePan2), is(true));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.junit.jupiter.api.Test;

import us.fatehi.creditcardnumber.AccountNumber;
import us.fatehi.creditcardnumber.AccountNumberSecure;
import us.fatehi.creditcardnumber.AccountNumbers;
import us.fatehi.creditcardnumber.CardBrand;
import us.fatehi.creditcardnumber.MajorIndustryIdentifier;
Expand Down Expand Up @@ -55,8 +54,8 @@ public void secureAccountNumber() {
assertThat(pan == securePan1, is(true));
assertThat(equivalent(pan, securePan1), is(true));

final AccountNumber securePan2 = new AccountNumberSecure(pan);
assertThat(pan != securePan2, is(true));
final AccountNumber securePan2 = AccountNumbers.secureAccountNumber(pan);
assertThat(securePan2, is(pan));
assertThat(equivalent(pan, securePan2), is(true));
}

Expand Down

0 comments on commit 84dbe04

Please sign in to comment.