Skip to content

Commit 6626096

Browse files
committed
Fix formatting
1 parent bfcd232 commit 6626096

File tree

1 file changed

+54
-52
lines changed

1 file changed

+54
-52
lines changed

log4j-core-test/src/test/java/org/apache/logging/log4j/core/filter/StringMatchFilterTest.java

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -16,71 +16,73 @@
1616
*/
1717
package org.apache.logging.log4j.core.filter;
1818

19+
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
21+
import static org.junit.jupiter.api.Assertions.assertNotNull;
22+
import static org.junit.jupiter.api.Assertions.assertNull;
23+
1924
import org.apache.logging.log4j.core.Filter;
2025
import org.apache.logging.log4j.core.config.Configuration;
2126
import org.apache.logging.log4j.core.test.junit.LoggerContextSource;
2227
import org.junit.jupiter.api.Assertions;
2328
import org.junit.jupiter.api.Test;
2429

25-
import static org.junit.jupiter.api.Assertions.assertEquals;
26-
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
27-
import static org.junit.jupiter.api.Assertions.assertNotNull;
28-
import static org.junit.jupiter.api.Assertions.assertNull;
29-
3030
/**
3131
* Unit test for {@link StringMatchFilter}.
3232
*/
3333
public class StringMatchFilterTest {
3434

35-
/**
36-
* Test that if no match-string is set on the builder, the '{@link StringMatchFilter.Builder#build()}' returns
37-
* {@code null}.
38-
*/
39-
@Test
40-
public void testFilterBuilderFailsWithNullText() {
41-
Assertions.assertNull(StringMatchFilter.newBuilder().build());
42-
}
43-
44-
/**
45-
* Test that if a {@code null} string is set as a match-pattern, an {@code IllegalArgumentExeption} is thrown.
46-
*/
47-
@Test
48-
void testFilterBuilderFailsWithExceptionOnNullText() {
49-
Assertions.assertThrows(IllegalArgumentException.class, () -> StringMatchFilter.newBuilder().setMatchString(null));
50-
}
35+
/**
36+
* Test that if no match-string is set on the builder, the '{@link StringMatchFilter.Builder#build()}' returns
37+
* {@code null}.
38+
*/
39+
@Test
40+
public void testFilterBuilderFailsWithNullText() {
41+
Assertions.assertNull(StringMatchFilter.newBuilder().build());
42+
}
5143

52-
/**
53-
* Test that if an empty ({@code ""}) string is set as a match-pattern, an {@code IllegalArgumentException} is thrown.
54-
*/
55-
@Test
56-
void testFilterBuilderFailsWithExceptionOnEmptyText() {
57-
Assertions.assertThrows(IllegalArgumentException.class, () -> StringMatchFilter.newBuilder().setMatchString(""));
58-
}
44+
/**
45+
* Test that if a {@code null} string is set as a match-pattern, an {@code IllegalArgumentExeption} is thrown.
46+
*/
47+
@Test
48+
void testFilterBuilderFailsWithExceptionOnNullText() {
49+
Assertions.assertThrows(IllegalArgumentException.class, () -> StringMatchFilter.newBuilder()
50+
.setMatchString(null));
51+
}
5952

60-
/**
61-
* Test that if a {@link StringMatchFilter} is specified with a 'text' attribute it is correctly instantiated.
62-
*
63-
* @param configuration the configuration
64-
*/
65-
@Test
66-
@LoggerContextSource("log4j2-stringmatchfilter-3153-ok.xml")
67-
void testConfigurationWithTextPOS(final Configuration configuration) {
68-
final Filter filter = configuration.getFilter();
69-
assertNotNull(filter, "The filter should not be null.");
70-
assertInstanceOf(StringMatchFilter.class, filter, "Expected a StringMatchFilter, but got: " + filter.getClass());
71-
assertEquals("FooBar", filter.toString());
72-
}
53+
/**
54+
* Test that if an empty ({@code ""}) string is set as a match-pattern, an {@code IllegalArgumentException} is thrown.
55+
*/
56+
@Test
57+
void testFilterBuilderFailsWithExceptionOnEmptyText() {
58+
Assertions.assertThrows(IllegalArgumentException.class, () -> StringMatchFilter.newBuilder()
59+
.setMatchString(""));
60+
}
7361

74-
/**
75-
* Test that if a {@link StringMatchFilter} is specified without a 'text' attribute it is not instantiated.
76-
*
77-
* @param configuration the configuration
78-
*/
79-
@Test
80-
@LoggerContextSource("log4j2-stringmatchfilter-3153-nok.xml")
81-
void testConfigurationWithTextNEG(final Configuration configuration) {
82-
final Filter filter = configuration.getFilter();
83-
assertNull(filter, "The filter should be null.");
84-
}
62+
/**
63+
* Test that if a {@link StringMatchFilter} is specified with a 'text' attribute it is correctly instantiated.
64+
*
65+
* @param configuration the configuration
66+
*/
67+
@Test
68+
@LoggerContextSource("log4j2-stringmatchfilter-3153-ok.xml")
69+
void testConfigurationWithTextPOS(final Configuration configuration) {
70+
final Filter filter = configuration.getFilter();
71+
assertNotNull(filter, "The filter should not be null.");
72+
assertInstanceOf(
73+
StringMatchFilter.class, filter, "Expected a StringMatchFilter, but got: " + filter.getClass());
74+
assertEquals("FooBar", filter.toString());
75+
}
8576

77+
/**
78+
* Test that if a {@link StringMatchFilter} is specified without a 'text' attribute it is not instantiated.
79+
*
80+
* @param configuration the configuration
81+
*/
82+
@Test
83+
@LoggerContextSource("log4j2-stringmatchfilter-3153-nok.xml")
84+
void testConfigurationWithTextNEG(final Configuration configuration) {
85+
final Filter filter = configuration.getFilter();
86+
assertNull(filter, "The filter should be null.");
87+
}
8688
}

0 commit comments

Comments
 (0)