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 java.util.Set; 9import javax.annotation.Nullable; 10import org.junit.runner.RunWith; 11import org.junit.runners.JUnit4; 12 13@RunWith(JUnit4.class) 14public class SomeTest { 15 16 <T> void check(@Nullable List<T> x) { 17 Preconditions.checkNodeNull(x); 18 } 19 20 void f() { 21 List<String> xs = null; 22 assertThat(xs).isNull(); 23 try { 24 check(xs); 25 fail(); 26 } catch (NullPointerException e) { 27 } 28 } 29} 30