Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.maven.shared.filtering;

import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;

Expand All @@ -41,7 +40,7 @@ public abstract class AbstractInterpolatorFilterReaderLineEndingTest {
private Interpolator interpolator;

@Test
public void testDefaults() throws Exception {
public void defaults() throws Exception {
when(interpolator.interpolate(eq("${a}"), eq(""), isA(RecursionInterceptor.class)))
.thenReturn("DONE_A");

Expand Down Expand Up @@ -84,7 +83,7 @@ public void testDefaults() throws Exception {

// MSHARED-198: custom delimiters doesn't work as expected
@Test
public void testCustomDelimiters() throws Exception {
public void customDelimiters() throws Exception {
when(interpolator.interpolate(eq("aaaFILTER.a.MEaaa"), eq(""), isA(RecursionInterceptor.class)))
.thenReturn("DONE");
when(interpolator.interpolate(eq("abcFILTER.a.MEabc"), eq(""), isA(RecursionInterceptor.class)))
Expand All @@ -102,7 +101,7 @@ public void testCustomDelimiters() throws Exception {

// MSHARED-235: reader exceeds readAheadLimit
@Test
public void testMarkInvalid() throws IOException {
public void markInvalid() throws Exception {
try (Reader reader = getAtReader(new StringReader("@\").replace(p,\"]\").replace(q,\""), interpolator, "\\")) {
assertEquals("@\").replace(p,\"]\").replace(q,\"", IOUtils.toString(reader));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,32 @@
/**
* @author Karl Heinz Marbaise <a href="mailto:khmarbaise@apache.org">khmarbaise@apache.org</a>.
*/
public class AbstractMavenFilteringRequestTest {
class AbstractMavenFilteringRequestTest {

private final AbstractMavenFilteringRequest request = new AbstractMavenFilteringRequest();
private final LinkedHashSet<String> delimiters = new LinkedHashSet<>();

@Test
public void setDelimitersShouldNotChangeAnythingIfUsingNull() {
void setDelimitersShouldNotChangeAnythingIfUsingNull() {
request.setDelimiters(null, false);
assertThat(request.getDelimiters(), Matchers.contains("${*}", "@"));
}

@Test
public void setDelimitersShouldNotChangeAnythingIfUsingEmpty() {
void setDelimitersShouldNotChangeAnythingIfUsingEmpty() {
request.setDelimiters(delimiters, false);
assertThat(request.getDelimiters(), Matchers.contains("${*}", "@"));
}

@Test
public void setDelimitersShouldAddOnlyTheGivenDelimiter() {
void setDelimitersShouldAddOnlyTheGivenDelimiter() {
delimiters.add("test");
request.setDelimiters(delimiters, false);
assertThat(request.getDelimiters(), Matchers.contains("test"));
}

@Test
public void setDelimitersShouldAddDefaultDelimitersForNullElements() {
void setDelimitersShouldAddDefaultDelimitersForNullElements() {
delimiters.add("test");
delimiters.add(null);
delimiters.add("second");
Expand All @@ -62,27 +62,27 @@ public void setDelimitersShouldAddDefaultDelimitersForNullElements() {
}

@Test
public void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfNullGiven() {
void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfNullGiven() {
request.setDelimiters(null, true);
assertThat(request.getDelimiters(), Matchers.contains("${*}", "@"));
}

@Test
public void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfNotNullGiven() {
void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfNotNullGiven() {
LinkedHashSet<String> delimiters = new LinkedHashSet<>();
request.setDelimiters(delimiters, true);
assertThat(request.getDelimiters(), Matchers.contains("${*}", "@"));
}

@Test
public void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfSingleElementIsGiven() {
void setDelimitersShouldAddDefaultDelimitersIfUseDefaultDelimitersIfSingleElementIsGiven() {
delimiters.add("test");
request.setDelimiters(delimiters, true);
assertThat(request.getDelimiters(), Matchers.contains("${*}", "@", "test"));
}

@Test
public void setDelimitersShouldAddDefaultDelimitersForNullElement() {
void setDelimitersShouldAddDefaultDelimitersForNullElement() {
delimiters.add("test");
delimiters.add(null);
delimiters.add("second");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package org.apache.maven.shared.filtering;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.util.Arrays;
Expand All @@ -28,12 +27,12 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

public class BoundedReaderTest {
class BoundedReaderTest {

private final Reader sr = new BufferedReader(new StringReader("01234567890"));

@Test
public void readTillEnd() throws IOException {
void readTillEnd() throws Exception {
try (BoundedReader mr = new BoundedReader(sr, 3)) {
mr.mark(3);
mr.read();
Expand All @@ -44,7 +43,7 @@ public void readTillEnd() throws IOException {
}

@Test
public void readMulti() throws IOException {
void readMulti() throws Exception {
char[] cbuf = new char[4];
Arrays.fill(cbuf, 'X');

Expand All @@ -60,7 +59,7 @@ public void readMulti() throws IOException {
}

@Test
public void readMultiWithOffset() throws IOException {
void readMultiWithOffset() throws Exception {

char[] cbuf = new char[4];
Arrays.fill(cbuf, 'X');
Expand All @@ -77,7 +76,7 @@ public void readMultiWithOffset() throws IOException {
}

@Test
public void resetWorks() throws IOException {
void resetWorks() throws Exception {
try (BoundedReader mr = new BoundedReader(sr, 3)) {
mr.read();
mr.read();
Expand All @@ -91,7 +90,7 @@ public void resetWorks() throws IOException {
}

@Test
public void skipTest() throws IOException {
void skipTest() throws Exception {
try (BoundedReader mr = new BoundedReader(sr, 3)) {
mr.skip(2);
mr.read();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package org.apache.maven.shared.filtering;

import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.nio.file.Files;
Expand Down Expand Up @@ -52,7 +51,7 @@
*
*/
@MavenDITest
public class DefaultMavenFileFilterTest {
class DefaultMavenFileFilterTest {

@Inject
Injector container;
Expand All @@ -65,7 +64,7 @@ protected void setUp() throws Exception {
}

@Test
public void testOverwriteFile() throws Exception {
void overwriteFile() throws Exception {
MavenFileFilter mavenFileFilter = container.getInstance(MavenFileFilter.class);

Path from = Paths.get(getBasedir(), "src/test/units-files/reflection-test.properties");
Expand All @@ -86,7 +85,7 @@ public void testOverwriteFile() throws Exception {
}

@Test
public void testNullSafeDefaultFilterWrappers() throws Exception {
void nullSafeDefaultFilterWrappers() throws Exception {
MavenFileFilter mavenFileFilter = container.getInstance(MavenFileFilter.class);

mavenFileFilter.getDefaultFilterWrappers(null, null, false, null, null);
Expand All @@ -95,7 +94,7 @@ public void testNullSafeDefaultFilterWrappers() throws Exception {
}

@Test
public void testMultiFilterFileInheritance() throws Exception {
void multiFilterFileInheritance() throws Exception {
DefaultMavenFileFilter mavenFileFilter = new DefaultMavenFileFilter(mock(BuildContext.class));

File testDir = new File(getBasedir(), "src/test/units-files/MSHARED-177");
Expand All @@ -116,7 +115,7 @@ public void testMultiFilterFileInheritance() throws Exception {
// MSHARED-161: DefaultMavenFileFilter.getDefaultFilterWrappers loads
// filters from the current directory instead of using basedir
@Test
public void testMavenBasedir() throws Exception {
void mavenBasedir() throws Exception {
MavenFileFilter mavenFileFilter = container.getInstance(MavenFileFilter.class);

AbstractMavenFilteringRequest req = new AbstractMavenFilteringRequest();
Expand All @@ -140,7 +139,7 @@ public void testMavenBasedir() throws Exception {

// MSHARED-198: custom delimiters doesn't work as expected
@Test
public void testCustomDelimiters() throws Exception {
void customDelimiters() throws Exception {
MavenFileFilter mavenFileFilter = container.getInstance(MavenFileFilter.class);

AbstractMavenFilteringRequest req = new AbstractMavenFilteringRequest();
Expand All @@ -160,7 +159,7 @@ public void testCustomDelimiters() throws Exception {

// MSHARED-199: Filtering doesn't work if 2 delimiters are used on the same line, the first one being left open
@Test
public void testLineWithSingleAtAndExpression() throws Exception {
void lineWithSingleAtAndExpression() throws Exception {
MavenFileFilter mavenFileFilter = container.getInstance(MavenFileFilter.class);

AbstractMavenFilteringRequest req = new AbstractMavenFilteringRequest();
Expand All @@ -176,7 +175,7 @@ public void testLineWithSingleAtAndExpression() throws Exception {
}

@Test
void testInterpolatorCustomizer() throws MavenFilteringException, IOException {
void interpolatorCustomizer() throws Exception {
AbstractMavenFilteringRequest req = new AbstractMavenFilteringRequest();
req.setInterpolatorCustomizer(i -> i.addValueSource(new AbstractValueSource(false) {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
* @author Kristian Rosenvold
*/
@MavenDITest
public class DefaultMavenReaderFilterTest {
class DefaultMavenReaderFilterTest {
@Inject
Injector container;

@Test
public void testJustDoSomeFiltering() throws Exception {
void justDoSomeFiltering() throws Exception {
MavenReaderFilter readerFilter = container.getInstance(MavenReaderFilter.class);

StringReader src = new StringReader("toto@titi.com ${foo}");
Expand Down
Loading