@Test public void testElvis() { final List<?> emptyList = ImmutableList.of(); final List<?> singletonList = ImmutableList.of("myVal"); final List<?> differentList = ImmutableList.of("differentVal"); assertEquals(elvis("", "string2"), "string2"); assertEquals(elvis("string1", "string2"), "string1"); assertEquals(elvis(null, "string2"), "string2"); assertEquals(elvis("", "string2"), "string2"); assertEquals((int)elvis(1, 2), 1); assertEquals((int)elvis(0, 2), 2); assertEquals(elvis(singletonList, differentList), singletonList); assertEquals(elvis(emptyList, differentList), differentList); assertEquals(elvis(gstring, "other"), gstringVal); assertEquals(elvis(emptyGstring, "other"), "other"); assertEquals(elvis(emptyGstring, gstring), gstringVal); }