-
-
Save heruan/817705978ad33926147ad8780785af4b to your computer and use it in GitHub Desktop.
Minimal example triggering error on VS Code: Testing with coverage
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
import org.junit.jupiter.api.Test; | |
import static org.junit.jupiter.api.Assertions.assertTrue; | |
class AnyTest { | |
@Test | |
void test() { | |
assertTrue(true); | |
} | |
} |
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
import java.util.List; | |
import java.util.function.Consumer; | |
import java.util.function.Function; | |
import java.util.function.Supplier; | |
public class Sample { | |
void sample(boolean x) { | |
var foo = getFoo(); | |
if (x) { | |
foo = new Foo(); // <-- BOTH THIS LINE | |
} | |
var bar = new Bar(); | |
var baz = new Baz(); | |
baz.from(bar::bar) | |
.as(Sample::toArray) // <-- AND THIS LINE | |
.to(foo::foo); | |
} | |
static String[] toArray(List<String> s) { | |
return s.toArray(String[]::new); | |
} | |
static Foo getFoo() { | |
return new Foo(); | |
} | |
static class Foo { | |
void foo(String... foo) { | |
} | |
} | |
static class Bar { | |
List<String> bar() { | |
return List.of("bar"); | |
} | |
} | |
static class Baz { | |
Baz from(Supplier<List<String>> from) { | |
return this; | |
} | |
Baz as(Function<List<String>, String[]> as) { | |
return this; | |
} | |
Baz to(Consumer<String[]> to) { | |
return this; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment