Skip to content

Commit

Permalink
Add failing test for regression introduced on eclipse-ee4j#4531
Browse files Browse the repository at this point in the history
Logs from outbound streams do not contain '...more...' on trimmed entities.
  • Loading branch information
nunomsantos committed Mar 18, 2022
1 parent 9bb2e8d commit 13b591a
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -284,6 +284,23 @@ public void testLoggingFeatureBuilderProperty() {
assertThat(record.getMessage(), containsString(SEPARATOR));
}

@Test(expected = AssertionError.class)
public void testLoggingFeatureMaxEntitySize() {
final Response response = target("/text")
.register(LoggingFeature.class)
.property(LoggingFeature.LOGGING_FEATURE_LOGGER_NAME, LOGGER_NAME)
.property(LoggingFeature.LOGGING_FEATURE_MAX_ENTITY_SIZE, 1)
.request()
.post(Entity.text(ENTITY));

// Correct response status.
assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode()));
// Check logs for trimmedEntity.
String trimmedEntity = ENTITY.charAt(0) + "...more...";
List<LogRecord> logRecords = getLoggedRecords();
assertThat(getLoggingFilterRequestLogRecord(logRecords).getMessage(), containsString(trimmedEntity));
assertThat(getLoggingFilterResponseLogRecord(logRecords).getMessage(), containsString(trimmedEntity));
}
}

/**
Expand Down

0 comments on commit 13b591a

Please sign in to comment.