Skip to content

Commit

Permalink
Merge pull request #409 from apache/test-log-spam-and-assert
Browse files Browse the repository at this point in the history
Remove log spam and minor test cleanup
  • Loading branch information
bdemers authored Nov 8, 2023
2 parents 8fd9a17 + 855671d commit b91fee9
Show file tree
Hide file tree
Showing 7 changed files with 226 additions and 315 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void initialize() throws Exception {
public void testResourcePassthrough() throws Exception {
UpdateRequest<ScimUser> updateRequest = new UpdateRequest<>("1234", createUser(), createUser(), schemaRegistry);
ScimUser result = updateRequest.getResource();
log.info("testResourcePassthrough: " + result);
log.debug("testResourcePassthrough: {}", result);
assertThat(result)
.isNotNull();
}
Expand All @@ -98,7 +98,7 @@ public void testResourcePassthrough() throws Exception {
public void testPatchPassthrough() throws Exception {
UpdateRequest<ScimUser> updateRequest = new UpdateRequest<>("1234", createUser(), createUser1PatchOps(), schemaRegistry);
List<PatchOperation> result = updateRequest.getPatchOperations();
log.info("testPatchPassthrough: " + result);
log.debug("testPatchPassthrough: {}", result);
assertThat(result)
.isNotNull();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public void testExcludeAttributesWithExtensions() throws Exception {
private void debugJson(Object resource) throws JsonGenerationException, JsonMappingException, IOException {
StringWriter sw = new StringWriter();
objectMapper.writeValue(sw, resource);
LOG.info(sw.toString());
LOG.debug(sw.toString());
}

private ScimUser getScimUser() throws PhoneNumberParseException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public class ExpressionBuildingListener extends FilterBaseListener {

@Override
public void exitFilter(FilterContext ctx) {
assert expressionStack.size() == 1 : "wrong number (" + expressionStack.size() + ") of expressions on stack, should be 1";
if (expressionStack.size() != 1) {
throw new IllegalStateException("Wrong number (" + expressionStack.size() + ") of expressions on stack, should be 1");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ private static String[] getAllFilters() {
@ParameterizedTest
@MethodSource("getAllFilters")
public void test(String filterText) throws Exception {
LOG.info("Running Filter Parser test on input: " + filterText);
LOG.debug("Running Filter Parser test on input: {}", filterText);
Filter filter = new Filter(filterText);
FilterExpression expression = filter.getExpression();
LOG.info("Parsed String: " + expression.toFilter());
LOG.debug("Parsed String: {}", expression.toFilter());
Assertions.assertNotNull(expression);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public static String[] pathValues() {
@MethodSource("pathValues")
public void testPathParsing(String value) throws Exception {
PatchOperationPath path = new PatchOperationPath(value);
log.info("ValuePathExpression: " + path.getValuePathExpression());
log.debug("ValuePathExpression: {}", path.getValuePathExpression());

String result = path.toString();
log.info(result);
log.debug(result);
Assertions.assertNotNull(path.getValuePathExpression());
Assertions.assertEquals(value.toLowerCase(), result.toLowerCase());
}
Expand Down
Loading

0 comments on commit b91fee9

Please sign in to comment.