Skip to content

Commit 8ba7439

Browse files
feat: test passed for testAddToList
1 parent 2ff9692 commit 8ba7439

File tree

1 file changed

+33
-1
lines changed
  • lesson_17/bank/bank_app/src/test/java/com/codedifferently/lesson17/bank

1 file changed

+33
-1
lines changed
Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
11
package com.codedifferently.lesson17.bank;
22

3-
public class AuditLogTest {}
3+
import java.util.UUID;
4+
5+
import org.junit.jupiter.api.BeforeEach;
6+
import org.junit.jupiter.api.Test;
7+
8+
public class AuditLogTest {
9+
private AuditLog auditLog;
10+
private UUID customerIdOne;
11+
private UUID customerIdTwo;
12+
13+
@BeforeEach
14+
void setUp(){
15+
auditLog = new AuditLog();
16+
customerIdOne = UUID.randomUUID();
17+
customerIdTwo = UUID.randomUUID();
18+
}
19+
20+
@Test
21+
void testAddToList(){
22+
// Arrange
23+
String logEntry1 = "Customer " + customerIdOne + " deposited $100.00";
24+
String logEntry2 = "Customer " + customerIdTwo + " withdrew $50.00";
25+
26+
// Act
27+
auditLog.addToList(logEntry1);
28+
auditLog.addToList(logEntry2);
29+
30+
// Assert
31+
assert(auditLog.getLogSize() == 2);
32+
assert(auditLog.getLogEntries().contains(logEntry1));
33+
assert(auditLog.getLogEntries().contains(logEntry2));
34+
}
35+
}

0 commit comments

Comments
 (0)