Пример #1
0
  @Test(groups = "fast")
  public void testJson() throws Exception {
    final String accountId = UUID.randomUUID().toString();

    final BigDecimal creditAmount = BigDecimal.TEN;
    final String invoiceId = UUID.randomUUID().toString();
    final String invoiceNumber = UUID.randomUUID().toString();
    final DateTime requestedDate = clock.getUTCNow();
    final DateTime effectiveDate = clock.getUTCNow();
    final String reason = UUID.randomUUID().toString();
    final List<AuditLogJson> auditLogs = createAuditLogsJson();
    final CreditJson creditJson =
        new CreditJson(
            creditAmount,
            invoiceId,
            invoiceNumber,
            requestedDate,
            effectiveDate,
            reason,
            accountId,
            auditLogs);

    final CreditCollectionJson creditCollectionJson =
        new CreditCollectionJson(accountId, ImmutableList.<CreditJson>of(creditJson));
    Assert.assertEquals(creditCollectionJson.getAccountId(), accountId);
    Assert.assertEquals(creditCollectionJson.getCredits().size(), 1);
    Assert.assertEquals(creditCollectionJson.getCredits().get(0), creditJson);
    Assert.assertEquals(creditCollectionJson.getCredits().get(0).getAuditLogs(), auditLogs);

    final String asJson = mapper.writeValueAsString(creditCollectionJson);
    final CreditCollectionJson fromJson = mapper.readValue(asJson, CreditCollectionJson.class);
    Assert.assertEquals(fromJson, creditCollectionJson);
  }
Пример #2
0
 public DefaultCallContext(
     final UUID tenantId,
     final String userName,
     final CallOrigin callOrigin,
     final UserType userType,
     final UUID userToken,
     final Clock clock) {
   super(tenantId, userName, callOrigin, userType, userToken);
   this.createdDate = clock.getUTCNow();
   this.updateDate = createdDate;
 }