Home | History | Annotate | Download | only in shadows
      1 package com.xtremelabs.robolectric.shadows;
      2 
      3 import android.accounts.Account;
      4 import android.content.PeriodicSync;
      5 import android.os.Bundle;
      6 import com.xtremelabs.robolectric.internal.Implements;
      7 import com.xtremelabs.robolectric.internal.RealObject;
      8 
      9 import java.lang.reflect.Field;
     10 
     11 @Implements(PeriodicSync.class)
     12 public class ShadowPeriodicSync {
     13 
     14     @RealObject
     15     private PeriodicSync realObject;
     16 
     17     public void __constructor__(Account account, String authority, Bundle extras, long period) throws Exception {
     18         setField("account", account);
     19         setField("authority", authority);
     20         setField("period", period);
     21         setField("extras", extras);
     22     }
     23 
     24 
     25     private void setField(String name, Object obj) throws Exception {
     26         Field f = realObject.getClass().getField(name);
     27         f.setAccessible(true);
     28         f.set(realObject, obj);
     29     }
     30 }
     31