Skip to content

Instantly share code, notes, and snippets.

@TsuyoshiUshio
Created April 30, 2020 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TsuyoshiUshio/9d2ea4678c6360322abfe1e12b9ed698 to your computer and use it in GitHub Desktop.
Save TsuyoshiUshio/9d2ea4678c6360322abfe1e12b9ed698 to your computer and use it in GitHub Desktop.
jMockit sample
public class SampleTest {
@Test
public void executeSample(
@Mocked final TypedData data1,
@Mocked final TypedData data2
) throws Exception {
new Expectations() {{
data1.getName(); result = "foo";
data2.getName(); result = "bar";
}};
assertEquals("foo", data1.getName());
assertEquals("bar", data2.getName());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment