Skip to content

Commit

Permalink
Merge branch 'work/using-react-with-bootstrap4'
Browse files Browse the repository at this point in the history
  • Loading branch information
steinarb committed Sep 29, 2024
2 parents b8000eb + 6105ad8 commit 5b85e08
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<parent>
<groupId>no.priv.bang.pom</groupId>
<artifactId>bang-authservice-client-pom</artifactId>
<version>2.0.4</version>
<version>2.0.5</version>
</parent>
<groupId>no.priv.bang.ukelonn</groupId>
<artifactId>ukelonn</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package no.priv.bang.ukelonn.beans;

import java.util.Date;
import static java.util.Optional.*;

public record Transaction(
int id,
Expand All @@ -24,6 +25,9 @@ public record Transaction(
double transactionAmount,
boolean paidOut)
{
public String getName() {
return ofNullable(transactionType).map(TransactionType::transactionTypeName).orElse(null);
}

public static Builder with(Transaction transaction) {
Builder builder = new Builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ void testNoArgConstructor() {
var bean = Transaction.with().build();
assertEquals(-1, bean.id());
assertNull(bean.transactionType());
assertNull(bean.getName());
assertNull(bean.transactionTime());
assertEquals(0.0, bean.transactionAmount(), 0.0);
assertFalse(bean.paidOut());
Expand All @@ -34,7 +35,7 @@ void testNoArgConstructor() {
@Test
void testConstructorWithArgs() {
var id = 5;
var transactionType = TransactionType.with().build();
var transactionType = TransactionType.with().transactionTypeName("Paid to account").build();
var transactionTime = new Date();
var transactionAmount = 100.0;
var paidOut = true;
Expand All @@ -46,6 +47,7 @@ void testConstructorWithArgs() {
.paidOut(paidOut)
.build();
assertEquals(id, bean.id());
assertEquals(transactionType.transactionTypeName(), bean.getName());
assertEquals(transactionType, bean.transactionType());
assertEquals(transactionTime, bean.transactionTime());
assertEquals(transactionAmount, bean.transactionAmount(), 0.0);
Expand Down

0 comments on commit 5b85e08

Please sign in to comment.