1package com.google.example; 2 3import static com.google.truth.Truth.assertThat; 4import static org.junit.Assert.fail; 5 6import com.google.common.base.Preconditions; 7import java.util.List; 8import javax.annotation.Nullable; 9import org.junit.runner.RunWith; 10import org.junit.runners.JUnit4; 11 12@RunWith( JUnit4.class ) public class SomeTest { 13 14 <T> void check(@Nullable List<T> x) { 15 Preconditions.checkNodeNull(x); 16 } 17 18 void f() { 19 List<String> xs = null; 20 assertThat(xs).isNull(); 21 try { 22 check(xs); 23 fail(); 24 } catch (NullPointerException e) { 25 } 26 } 27} 28