@Test public void testSingleton() throws Exception { Context context = Robolectric.getShadowApplication().getApplicationContext(); Pig pig1 = Pig.get(context); Pig pig2 = Pig.get(context); assertTrue(pig1 == pig2); }
public static Pig get(Context context) { if (sPig == null) { sPig = new Pig(context); } return sPig; }
Pig { public static Pig get(Context context) { if (sPig == null) { sPig = new Pig(context); } return sPig; } }
Pig { public static Pig get(Context context) { if (sPig == null) { sPig = new Pig(context); } return sPig; } private  Pig(Context context);   Pig(Context context, WebViewWrapper webViewWrapper); }
Pig { public static Pig get(Context context) { if (sPig == null) { sPig = new Pig(context); } return sPig; } private  Pig(Context context);   Pig(Context context, WebViewWrapper webViewWrapper); static Pig get(Context context); void execute(String path); void execute(String path, Callback<R> callback); void execute(String path, Object data, Callback<R> callback); @SuppressWarnings("unchecked") // We are checking the type before casting void execute(String path, Type dataClass, D data, Callback<R> callback); void execute(String path, Type responseType, Callback<R> callback); void execute(String path, D data, Type responseType, Callback<R> callback); void execute(String path, Type dataType, D data, Type responseType, Callback<R> callback); void execute(String path, String json, Type responseType, Callback<R> callback); synchronized void addListener(String event, EventListener listener); synchronized void removeListener(String event, EventListener listener); void emit(String event); void emit(String event, String data); }
Pig { public static Pig get(Context context) { if (sPig == null) { sPig = new Pig(context); } return sPig; } private  Pig(Context context);   Pig(Context context, WebViewWrapper webViewWrapper); static Pig get(Context context); void execute(String path); void execute(String path, Callback<R> callback); void execute(String path, Object data, Callback<R> callback); @SuppressWarnings("unchecked") // We are checking the type before casting void execute(String path, Type dataClass, D data, Callback<R> callback); void execute(String path, Type responseType, Callback<R> callback); void execute(String path, D data, Type responseType, Callback<R> callback); void execute(String path, Type dataType, D data, Type responseType, Callback<R> callback); void execute(String path, String json, Type responseType, Callback<R> callback); synchronized void addListener(String event, EventListener listener); synchronized void removeListener(String event, EventListener listener); void emit(String event); void emit(String event, String data);  }