Skip to content

Commit

Permalink
Merge pull request #15 from sualeh/v4
Browse files Browse the repository at this point in the history
v4.0.1
  • Loading branch information
sualeh authored Feb 25, 2022
2 parents 4177fbb + 95cf643 commit fc8142b
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Some resources consulted are:
- Internationalization of card numbers is supported
- Validity is enforced by JUnit 5 tests
- Java 8 or newer is required
- Android friendly, even though Java 8 Date and Time API is used
- Android friendly


## Download and Use in Projects
Expand Down
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
- ":children_crossing: dependencies"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
- ":children_crossing: dependencies"
14 changes: 6 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>us.fatehi</groupId>
<artifactId>creditcardnumber</artifactId>
<version>3.2.1</version>
<version>4.0.1</version>
<packaging>jar</packaging>
<name>Credit Card Number</name>
<description>Credit Card Number is a library that can provide details of a bank issued credit card number. All classes are immutable and thread-safe. The standard `toString()` function formats data in a readable form.</description>
Expand Down Expand Up @@ -60,7 +60,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.0</version>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -72,7 +72,7 @@
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<version>3.7.1</version>
<version>3.9</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -170,10 +170,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- Android friendly, even though Java 8 Date and Time API is
used -->
<source>7</source>
<target>7</target>
<source>8</source>
<target>8</target>
<compilerArgs>
<arg>-Werror</arg>
</compilerArgs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* <p>See <a href=
* "https://en.wikipedia.org/wiki/Bank_card_number#Major_Industry_Identifier_.28MII.29">Major
* Industry Identifier</a>
*
* @author Sualeh Fatehi
*/
public enum MajorIndustryIdentifier {
unknown(-1, "unknown"),
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/us/fatehi/creditcardnumber/ServiceCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
/**
* See <a href= "https://en.wikipedia.org/wiki/Magnetic_stripe_card#Financial_cards">Wikipedia:
* Financial Cards</a>
*
* @author Sualeh Fatehi
*/
public final class ServiceCode extends BaseRawData implements Serializable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import org.junit.jupiter.api.function.Executable;

import us.fatehi.creditcardnumber.AccountNumber;
import us.fatehi.creditcardnumber.AccountNumbers;
Expand Down Expand Up @@ -144,13 +143,7 @@ public void sealedAccountNumberException()
final Exception exception =
assertThrows(
RuntimeException.class,
new Executable() {

@Override
public void execute() throws Throwable {
AccountNumbers.sealedAccountNumber(rawAccountNumber, cipher);
}
});
() -> AccountNumbers.sealedAccountNumber(rawAccountNumber, cipher));
assertThat(exception.getMessage(), is("Cannot created sealed account number"));
assertThat(exception.getCause().getClass().getSimpleName(), is("IllegalStateException"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import static org.junit.jupiter.api.Assertions.assertThrows;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;

import nl.jqno.equalsverifier.EqualsVerifier;
import us.fatehi.creditcardnumber.DisposableStringData;
Expand All @@ -36,40 +35,16 @@ public void dispose() {
assertThat(data.length(), is(8));
assertThat(data.charAt(0), is('s'));

assertThrows(
ArrayIndexOutOfBoundsException.class,
new Executable() {

@Override
public void execute() throws Throwable {
data.charAt(-1);
}
});
assertThrows(
ArrayIndexOutOfBoundsException.class,
new Executable() {

@Override
public void execute() throws Throwable {
data.charAt(8);
}
});
assertThrows(ArrayIndexOutOfBoundsException.class, () -> data.charAt(-1));
assertThrows(ArrayIndexOutOfBoundsException.class, () -> data.charAt(8));

data.disposeData();
assertThat(data.hasData(), is(false));
assertThat(data.getData(), is(nullValue()));
assertThat(data.toString(), is(""));
assertThat(data.subSequence(0, 0).toString(), is(""));
assertThat(data.length(), is(0));
assertThrows(
ArrayIndexOutOfBoundsException.class,
new Executable() {

@Override
public void execute() throws Throwable {
data.charAt(0);
}
});
assertThrows(ArrayIndexOutOfBoundsException.class, () -> data.charAt(0));
}

@Test
Expand Down

0 comments on commit fc8142b

Please sign in to comment.