File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed
lesson_17/bank/bank_app/src/test/java/com/codedifferently/lesson17/bank Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change 11package 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+ }
You can’t perform that action at this time.
0 commit comments