Skip to content

Instantly share code, notes, and snippets.

View virgilio's full-sized avatar

Virgílio N Santos virgilio

  • Matchbox Ideas
  • Campinas-SP, Brazil
View GitHub Profile
@virgilio
virgilio / MockParcel.java
Created June 2, 2016 21:57 — forked from Sloy/MockParcel.java
MockParcel for testing Parcelables implementations with the new Android's Unit testing support (http://tools.android.com/tech-docs/unit-testing-support). Only String and Long read/write implemented here. Add mock methods for other types.
import android.os.Parcel;
import java.util.ArrayList;
import java.util.List;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doAnswer;