|
16 | 16 | import java.util.HashMap; |
17 | 17 | import java.util.List; |
18 | 18 | import java.util.Map; |
| 19 | +import org.databunker.options.TokenOptions; |
19 | 20 |
|
20 | 21 | import static org.junit.Assert.*; |
21 | 22 |
|
@@ -80,10 +81,11 @@ public void testCreditCardTokenization() throws IOException { |
80 | 81 |
|
81 | 82 | // Step 1: Tokenize a credit card number |
82 | 83 | String creditCardNumber = "5467047429390590"; |
83 | | - Map<String, Object> options = new HashMap<>(); |
84 | | - options.put("slidingtime", "1d"); |
85 | | - options.put("finaltime", "12m"); |
86 | | - options.put("unique", true); |
| 84 | + TokenOptions options = new TokenOptions.Builder() |
| 85 | + .slidingtime("1d") |
| 86 | + .finaltime("12m") |
| 87 | + .unique(true) |
| 88 | + .build(); |
87 | 89 |
|
88 | 90 | Map<String, Object> tokenResult = api.createToken("creditcard", creditCardNumber, options, null); |
89 | 91 | assertNotNull(tokenResult); |
@@ -160,10 +162,11 @@ public void testBulkCreditCardTokenization() throws IOException { |
160 | 162 | records[i] = record; |
161 | 163 | } |
162 | 164 |
|
163 | | - Map<String, Object> options = new HashMap<>(); |
164 | | - options.put("slidingtime", "30d"); |
165 | | - options.put("finaltime", "12m"); |
166 | | - options.put("unique", true); |
| 165 | + TokenOptions options = new TokenOptions.Builder() |
| 166 | + .slidingtime("30d") |
| 167 | + .finaltime("12m") |
| 168 | + .unique(true) |
| 169 | + .build(); |
167 | 170 |
|
168 | 171 | Map<String, Object> bulkTokens = api.createTokensBulk(records, options, null); |
169 | 172 | System.out.println("Bulk tokens: " + bulkTokens); |
@@ -244,7 +247,7 @@ public void testBulkCreditCardTokenization() throws IOException { |
244 | 247 |
|
245 | 248 | try { |
246 | 249 | // Test with empty records array |
247 | | - Map<String, Object> emptyRecordsResponse = api.createTokensBulk(new Map[0], options, null); |
| 250 | + Map<String, Object> emptyRecordsResponse = api.createTokensBulk(new Map[0], (TokenOptions) null, null); |
248 | 251 | if (emptyRecordsResponse != null) { |
249 | 252 | assertEquals("error", emptyRecordsResponse.get("status")); |
250 | 253 | assertNotNull(emptyRecordsResponse.get("message")); |
|
0 commit comments