Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SP-752 Code Examples: Java #265

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
java-version: [8, 11, 17]
java-version: [8, 11, 17, 21]

steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@
<version>4.11.0</version>
<scope>test</scope>
</dependency>
<!-- Support Mockito 4.x for Java 21 -->
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.11</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down
157 changes: 79 additions & 78 deletions src/test/java/com/bitpay/sdk/model/settlement/SettlementTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package com.bitpay.sdk.model.settlement;

import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.List;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -76,84 +77,84 @@ public void it_should_change_status() {
// then
Assertions.assertEquals(expected, testedClass.getStatus());
}
//
// @Test
// public void it_should_change_dateCreated() {
// // given
// Long expected = 12L;
// Settlement testedClass = this.getTestedClass();
//
// // when
// testedClass.setDateCreated(expected);
//
// // then
// Assertions.assertEquals(expected, testedClass.getDateCreated());
// }
//
// @Test
// public void it_should_change_dateExecuted() {
// // given
// Long expected = 12L;
// Settlement testedClass = this.getTestedClass();
//
// // when
// testedClass.setDateExecuted(expected);
//
// // then
// Assertions.assertEquals(expected, testedClass.getDateExecuted());
// }
//
// @Test
// public void it_should_change_dateCompleted() {
// // given
// Long expected = 12L;
// Settlement testedClass = this.getTestedClass();
//
// // when
// testedClass.setDateCompleted(expected);
//
// // then
// Assertions.assertEquals(expected, testedClass.getDateCompleted());
// }
//
// @Test
// public void it_should_change_openingDate() {
// // given
// Long expected = 12L;
// Settlement testedClass = this.getTestedClass();
//
// // when
// testedClass.setOpeningDate(expected);
//
// // then
// Assertions.assertEquals(expected, testedClass.getOpeningDate());
// }
//
// @Test
// public void it_should_change_closingDate() {
// // given
// Long expected = 12L;
// Settlement testedClass = this.getTestedClass();
//
// // when
// testedClass.setClosingDate(expected);
//
// // then
// Assertions.assertEquals(expected, testedClass.getClosingDate());
// }
//
// @Test
// public void it_should_change_openingBalance() {
// // given
// Float expected = 12.34F;
// Settlement testedClass = this.getTestedClass();
//
// // when
// testedClass.setOpeningBalance(expected);
//
// // then
// Assertions.assertEquals(expected, testedClass.getOpeningBalance());
// }

@Test
public void it_should_change_dateCreated() {
// given
ZonedDateTime expected = ZonedDateTime.now();
Settlement testedClass = this.getTestedClass();

// when
testedClass.setDateCreated(expected);

// then
Assertions.assertEquals(expected, testedClass.getDateCreated());
}

@Test
public void it_should_change_dateExecuted() {
// given
ZonedDateTime expected = ZonedDateTime.now();
Settlement testedClass = this.getTestedClass();

// when
testedClass.setDateExecuted(expected);

// then
Assertions.assertEquals(expected, testedClass.getDateExecuted());
}

@Test
public void it_should_change_dateCompleted() {
// given
ZonedDateTime expected = ZonedDateTime.now();
Settlement testedClass = this.getTestedClass();

// when
testedClass.setDateCompleted(expected);

// then
Assertions.assertEquals(expected, testedClass.getDateCompleted());
}

@Test
public void it_should_change_openingDate() {
// given
ZonedDateTime expected = ZonedDateTime.now();
Settlement testedClass = this.getTestedClass();

// when
testedClass.setOpeningDate(expected);

// then
Assertions.assertEquals(expected, testedClass.getOpeningDate());
}

@Test
public void it_should_change_closingDate() {
// given
ZonedDateTime expected = ZonedDateTime.now();
Settlement testedClass = this.getTestedClass();

// when
testedClass.setClosingDate(expected);

// then
Assertions.assertEquals(expected, testedClass.getClosingDate());
}

@Test
public void it_should_change_openingBalance() {
// given
Float expected = 12.34F;
Settlement testedClass = this.getTestedClass();

// when
testedClass.setOpeningBalance(expected);

// then
Assertions.assertEquals(expected, testedClass.getOpeningBalance());
}

@Test
public void it_should_change_ledgerEntriesSum() {
Expand Down