Skip to content
Closed
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
@@ -1,22 +1,5 @@
package org.codehaus.plexus.interpolation;

/*
* Copyright 2007 The Codehaus Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

Expand All @@ -28,15 +11,15 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

public class EnvarBasedValueSourceTest {
class EnvarBasedValueSourceTest {

@BeforeEach
public void setUp() {
void setUp() {
EnvarBasedValueSource.resetStatics();
}

@Test
void testNoArgConstructorIsCaseSensitive() throws IOException {
void noArgConstructorIsCaseSensitive() throws Exception {
OperatingSystemUtils.setEnvVarSource(new OperatingSystemUtils.EnvVarSource() {
public Map<String, String> getEnvMap() {
HashMap<String, String> map = new HashMap<String, String>();
Expand All @@ -54,7 +37,7 @@ public Map<String, String> getEnvMap() {
}

@Test
void testCaseInsensitive() throws IOException {
void caseInsensitive() throws Exception {
OperatingSystemUtils.setEnvVarSource(new OperatingSystemUtils.EnvVarSource() {
public Map<String, String> getEnvMap() {
HashMap<String, String> map = new HashMap<String, String>();
Expand All @@ -72,7 +55,7 @@ public Map<String, String> getEnvMap() {
}

@Test
void testGetRealEnvironmentVariable() throws IOException {
void getRealEnvironmentVariable() throws Exception {
OperatingSystemUtils.setEnvVarSource(new OperatingSystemUtils.DefaultEnvVarSource());

EnvarBasedValueSource source = new EnvarBasedValueSource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class FeedbackingValueSourceTest {
class FeedbackingValueSourceTest {

@Test
public void testStandalone() {
void standalone() {
ValueSource valueSource = new FeedbackingValueSource();
assertNull(valueSource.getValue("test"));
assertEquals(1, valueSource.getFeedback().size());
assertEquals("'test' not resolved", valueSource.getFeedback().iterator().next());
}

@Test
public void testAfterResolvedExpression() throws InterpolationException {
void afterResolvedExpression() throws Exception {
StringSearchInterpolator interpolator = new StringSearchInterpolator();
interpolator.addValueSource(new MapBasedValueSource(singletonMap("key", "val")));
interpolator.addValueSource(new FeedbackingValueSource());
Expand All @@ -43,7 +43,7 @@ public void testAfterResolvedExpression() throws InterpolationException {
}

@Test
public void testBeforeResolvedExpression() throws InterpolationException {
void beforeResolvedExpression() throws Exception {
StringSearchInterpolator interpolator = new StringSearchInterpolator();
interpolator.addValueSource(new FeedbackingValueSource("Resolving ${expression}"));
interpolator.addValueSource(new MapBasedValueSource(singletonMap("key", "val")));
Expand All @@ -53,7 +53,7 @@ public void testBeforeResolvedExpression() throws InterpolationException {
}

@Test
public void testAfterNotResolvedExpression() throws InterpolationException {
void afterNotResolvedExpression() throws Exception {
StringSearchInterpolator interpolator = new StringSearchInterpolator();
interpolator.addValueSource(new MapBasedValueSource(singletonMap("key", "val")));
interpolator.addValueSource(new FeedbackingValueSource());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
* @author cstamas
*
*/
public class InterpolatorFilterReaderTest {
class InterpolatorFilterReaderTest {
/*
* Added and commented by jdcasey@03-Feb-2005 because it is a bug in the InterpolationFilterReader.
* kenneyw@15-04-2005 fixed the bug.
*/
@Test
public void testShouldNotInterpolateExpressionAtEndOfDataWithInvalidEndToken() throws Exception {
void shouldNotInterpolateExpressionAtEndOfDataWithInvalidEndToken() throws Exception {
Map m = new HashMap();
m.put("test", "TestValue");

Expand All @@ -60,7 +60,7 @@ public void testShouldNotInterpolateExpressionAtEndOfDataWithInvalidEndToken() t
* kenneyw@14-04-2005 Added test to check above fix.
*/
@Test
public void testShouldNotInterpolateExpressionWithMissingEndToken() throws Exception {
void shouldNotInterpolateExpressionWithMissingEndToken() throws Exception {
Map m = new HashMap();
m.put("test", "TestValue");

Expand All @@ -70,7 +70,7 @@ public void testShouldNotInterpolateExpressionWithMissingEndToken() throws Excep
}

@Test
public void testShouldNotInterpolateWithMalformedStartToken() throws Exception {
void shouldNotInterpolateWithMalformedStartToken() throws Exception {
Map m = new HashMap();
m.put("test", "testValue");

Expand All @@ -80,7 +80,7 @@ public void testShouldNotInterpolateWithMalformedStartToken() throws Exception {
}

@Test
public void testShouldNotInterpolateWithMalformedEndToken() throws Exception {
void shouldNotInterpolateWithMalformedEndToken() throws Exception {
Map m = new HashMap();
m.put("test", "testValue");

Expand All @@ -90,7 +90,7 @@ public void testShouldNotInterpolateWithMalformedEndToken() throws Exception {
}

@Test
public void testDefaultInterpolationWithNonInterpolatedValueAtEnd() throws Exception {
void defaultInterpolationWithNonInterpolatedValueAtEnd() throws Exception {
Map m = new HashMap();
m.put("name", "jason");
m.put("noun", "asshole");
Expand All @@ -101,7 +101,7 @@ public void testDefaultInterpolationWithNonInterpolatedValueAtEnd() throws Excep
}

@Test
public void testDefaultInterpolationWithInterpolatedValueAtEnd() throws Exception {
void defaultInterpolationWithInterpolatedValueAtEnd() throws Exception {
Map m = new HashMap();
m.put("name", "jason");
m.put("noun", "asshole");
Expand All @@ -112,7 +112,7 @@ public void testDefaultInterpolationWithInterpolatedValueAtEnd() throws Exceptio
}

@Test
public void testInterpolationWithInterpolatedValueAtEndWithCustomToken() throws Exception {
void interpolationWithInterpolatedValueAtEndWithCustomToken() throws Exception {
Map m = new HashMap();
m.put("name", "jason");
m.put("noun", "asshole");
Expand All @@ -123,7 +123,7 @@ public void testInterpolationWithInterpolatedValueAtEndWithCustomToken() throws
}

@Test
public void testInterpolationWithInterpolatedValueAtEndWithCustomTokenAndCustomString() throws Exception {
void interpolationWithInterpolatedValueAtEndWithCustomTokenAndCustomString() throws Exception {
Map m = new HashMap();
m.put("name", "jason");
m.put("noun", "asshole");
Expand All @@ -134,7 +134,7 @@ public void testInterpolationWithInterpolatedValueAtEndWithCustomTokenAndCustomS
}

@Test
public void testEscape() throws Exception {
void escape() throws Exception {
Map m = new HashMap();
m.put("name", "jason");
m.put("noun", "asshole");
Expand All @@ -145,7 +145,7 @@ public void testEscape() throws Exception {
}

@Test
public void testEscapeAtStart() throws Exception {
void escapeAtStart() throws Exception {
Map m = new HashMap();
m.put("name", "jason");
m.put("noun", "asshole");
Expand All @@ -156,7 +156,7 @@ public void testEscapeAtStart() throws Exception {
}

@Test
public void testEscapeOnlyAtStart() throws Exception {
void escapeOnlyAtStart() throws Exception {
Map m = new HashMap();
m.put("name", "jason");
m.put("noun", "asshole");
Expand All @@ -168,7 +168,7 @@ public void testEscapeOnlyAtStart() throws Exception {
}

@Test
public void testEscapeOnlyAtStartDefaultToken() throws Exception {
void escapeOnlyAtStartDefaultToken() throws Exception {
Map m = new HashMap();
m.put("name", "jason");
m.put("noun", "asshole");
Expand All @@ -180,7 +180,7 @@ public void testEscapeOnlyAtStartDefaultToken() throws Exception {
}

@Test
public void testShouldDetectRecursiveExpressionPassingThroughTwoPrefixes() throws Exception {
void shouldDetectRecursiveExpressionPassingThroughTwoPrefixes() throws Exception {
List prefixes = new ArrayList();

prefixes.add("prefix1");
Expand Down Expand Up @@ -211,7 +211,7 @@ public void testShouldDetectRecursiveExpressionPassingThroughTwoPrefixes() throw
}

@Test
public void testShouldDetectRecursiveExpressionWithPrefixAndWithout() throws Exception {
void shouldDetectRecursiveExpressionWithPrefixAndWithout() throws Exception {
List prefixes = new ArrayList();

prefixes.add("prefix1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class PrefixAwareRecursionInterceptorTest {
class PrefixAwareRecursionInterceptorTest {

@Test
public void testFindExpression() {
void findExpression() {
PrefixAwareRecursionInterceptor receptor =
new PrefixAwareRecursionInterceptor(Collections.singleton("prefix."));

Expand All @@ -45,7 +45,7 @@ public void testFindExpression() {
}

@Test
public void testFindExpressionWithDifferentPrefix() {
void findExpressionWithDifferentPrefix() {
PrefixAwareRecursionInterceptor receptor =
new PrefixAwareRecursionInterceptor(Arrays.asList(new String[] {"prefix.", "other."}));

Expand All @@ -61,7 +61,7 @@ public void testFindExpressionWithDifferentPrefix() {
}

@Test
public void testFindExpressionWithoutPrefix() {
void findExpressionWithoutPrefix() {
PrefixAwareRecursionInterceptor receptor =
new PrefixAwareRecursionInterceptor(Arrays.asList(new String[] {"prefix.", "other."}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

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

public class PrefixedObjectValueSourceTest {
class PrefixedObjectValueSourceTest {

@Test
public void testEmptyExpressionResultsInNullReturn_NoPrefixUsed() {
void emptyExpressionResultsInNullReturnNoPrefixUsed() {
String target = "Target object";

List prefixes = new ArrayList();
Expand All @@ -40,7 +40,7 @@ public void testEmptyExpressionResultsInNullReturn_NoPrefixUsed() {
}

@Test
public void testEmptyExpressionResultsInNullReturn_PrefixUsedWithDot() {
void emptyExpressionResultsInNullReturnPrefixUsedWithDot() {
String target = "Target object";

List prefixes = new ArrayList();
Expand All @@ -54,7 +54,7 @@ public void testEmptyExpressionResultsInNullReturn_PrefixUsedWithDot() {
}

@Test
public void testEmptyExpressionResultsInNullReturn_PrefixUsedWithoutDot() {
void emptyExpressionResultsInNullReturnPrefixUsedWithoutDot() {
String target = "Target object";

List prefixes = new ArrayList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

public class PrefixedValueSourceWrapperTest {
class PrefixedValueSourceWrapperTest {

@Test
public void testShouldReturnValueForPropertyVSWRappedWithSinglePrefix() {
void shouldReturnValueForPropertyVSWRappedWithSinglePrefix() {
String prefix = "prefix.";
String key = "key";
String value = "value";
Expand All @@ -41,7 +41,7 @@ public void testShouldReturnValueForPropertyVSWRappedWithSinglePrefix() {
}

@Test
public void testShouldReturnNullForIncorrectPrefixUsingPropertyVSWRappedWithSinglePrefix() {
void shouldReturnNullForIncorrectPrefixUsingPropertyVSWRappedWithSinglePrefix() {
String prefix = "prefix.";
String otherPrefix = "other.";
String key = "key";
Expand All @@ -57,7 +57,7 @@ public void testShouldReturnNullForIncorrectPrefixUsingPropertyVSWRappedWithSing
}

@Test
public void testShouldNullForMissingValueInPropertyVSWRappedWithSinglePrefix() {
void shouldNullForMissingValueInPropertyVSWRappedWithSinglePrefix() {
String prefix = "prefix.";
String key = "key";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

public class PropertiesBasedValueSourceTest {
class PropertiesBasedValueSourceTest {

@Test
public void testPropertyShouldReturnValueFromProperties() {
void propertyShouldReturnValueFromProperties() {
Properties props = new Properties();

String key = "key";
Expand All @@ -40,7 +40,7 @@ public void testPropertyShouldReturnValueFromProperties() {
}

@Test
public void testPropertyShouldReturnNullWhenPropertyMissing() {
void propertyShouldReturnNullWhenPropertyMissing() {
Properties props = new Properties();

String key = "key";
Expand Down
Loading