Last active
December 22, 2015 10:49
-
-
Save jelford/6461525 to your computer and use it in GitHub Desktop.
This will bite you if you use Guava's ImmutableX types.
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
public class AppTest | |
{ | |
@Rule public JUnitRuleMockery context = new JUnitRuleMockery(); | |
public static interface ColGetter { | |
public abstract Col get(); | |
} | |
public static interface NonColGetter { | |
public abstract NonCol get(); | |
} | |
@Test | |
public void cantDoCollection() { | |
final ColGetter icut = context.mock(ColGetter.class); | |
context.checking(new Expectations() {{ | |
oneOf(icut).get(); | |
will(returnValue(null)); | |
}}); | |
icut.get(); | |
} | |
@Test | |
public void canDoNonCollection() { | |
final NonColGetter icut = context.mock(NonColGetter.class); | |
context.checking(new Expectations() {{ | |
oneOf(icut).get(); | |
will(returnValue(null)); | |
}}); | |
icut.get(); | |
} | |
public abstract class Col implements Collection { | |
} | |
public abstract class NonCol { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment