Skip to content

Commit 329a690

Browse files
committed
Polish "Permit use of @jsontest without Jackson"
Closes gh-16070
1 parent 36f7188 commit 329a690

File tree

1 file changed

+8
-6
lines changed
  • spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json

1 file changed

+8
-6
lines changed

spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonExcludeFilter.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,18 +34,20 @@
3434
*/
3535
class JsonExcludeFilter extends AnnotationCustomizableTypeExcludeFilter {
3636

37+
private static final String JACKSON_MODULE = "com.fasterxml.jackson.databind.Module";
38+
3739
private static final Set<Class<?>> DEFAULT_INCLUDES;
3840

3941
static {
4042
Set<Class<?>> includes = new LinkedHashSet<Class<?>>();
41-
includes.add(JsonComponent.class);
4243
try {
43-
includes.add(ClassUtils.forName("com.fasterxml.jackson.databind.Module", null));
44-
} catch (Exception ex) {
45-
// Ignore
44+
includes.add(ClassUtils.forName(JACKSON_MODULE, null));
45+
}
46+
catch (Exception ex) {
4647
}
48+
includes.add(JsonComponent.class);
4749
DEFAULT_INCLUDES = Collections.unmodifiableSet(includes);
48-
};
50+
}
4951

5052
private final JsonTest annotation;
5153

0 commit comments

Comments
 (0)