Skip to content

Commit

Permalink
refactor and fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Gintas Grigelionis committed Aug 25, 2017
1 parent 90c42ec commit b691f81
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import org.junit.Test;

import static org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor.replaceSelfFallbackPattern;
import static org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor.replaceThisFallbackPattern;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

Expand All @@ -31,15 +33,11 @@ public class DefaultDependencyDescriptorTest {
*/
@Test
public void testReplaceSelfFallbackPattern() {
String replacedConf = DefaultDependencyDescriptor.replaceSelfFallbackPattern("@(default)",
"compile");
assertEquals("compile(default)", replacedConf);
assertEquals("compile(default)", replaceSelfFallbackPattern("@(default)", "compile"));

replacedConf = DefaultDependencyDescriptor.replaceSelfFallbackPattern("default", "compile");
assertNull(replacedConf);
assertNull(replaceSelfFallbackPattern("default", "compile"));

replacedConf = DefaultDependencyDescriptor.replaceSelfFallbackPattern("@", "runtime");
assertEquals("runtime", "runtime");
assertEquals("runtime", replaceSelfFallbackPattern("@", "runtime"));

}

Expand All @@ -49,15 +47,11 @@ public void testReplaceSelfFallbackPattern() {
*/
@Test
public void testReplaceThisFallbackPattern() {
String replacedConf = DefaultDependencyDescriptor.replaceThisFallbackPattern("#(default)",
"compile");
assertEquals("compile(default)", replacedConf);
assertEquals("compile(default)", replaceThisFallbackPattern("#(default)", "compile"));

replacedConf = DefaultDependencyDescriptor.replaceThisFallbackPattern("default", "compile");
assertNull(replacedConf);
assertNull(replaceThisFallbackPattern("default", "compile"));

replacedConf = DefaultDependencyDescriptor.replaceThisFallbackPattern("#", "runtime");
assertEquals("runtime", "runtime");
assertEquals("runtime", replaceThisFallbackPattern("#", "runtime"));

}

Expand Down

0 comments on commit b691f81

Please sign in to comment.