Last active
June 3, 2017 22:14
-
-
Save vdergachev/3dd0908ec0301b1e0357005e669cc726 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.get.some; | |
import org.apache.commons.lang.StringUtils; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.springframework.boot.test.SpringApplicationConfiguration; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | |
import java.util.Arrays; | |
@RunWith(SpringJUnit4ClassRunner.class) | |
@SpringApplicationConfiguration(classes = {MavenDepPluginBugIT.class}) | |
@Configuration | |
public class MavenDepPluginBugIT { | |
@Test | |
public void test() { | |
// 1 | |
foo(Arrays.asList("one", null, "three"), StringUtils::isEmpty); | |
// 2 | |
// if(StringUtils.isEmpty("asd")) { | |
// System.out.println("empty"); | |
// }; | |
} | |
interface Operation { | |
boolean isEmpty(String val); | |
} | |
private static void foo(final Iterable<String> it, final Operation operation) { | |
if (it == null) { | |
return; | |
} | |
it.forEach(string -> { | |
if (!operation.isEmpty(string)) { | |
System.out.println(string); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment