use of com.optimizely.ab.android.datafile_handler.DatafileServiceConnection in project android-sdk by optimizely.
the class OptimizelyManagerDatafileServiceConnectionTest method setup.
@Before
public void setup() {
Context context = mock(Context.class);
datafileServiceConnection = new DatafileServiceConnection(optimizelyManager.getDatafileConfig(), context, optimizelyManager.getDatafileLoadedListener(context, null));
}
use of com.optimizely.ab.android.datafile_handler.DatafileServiceConnection in project android-sdk by optimizely.
the class OptimizelyManagerDatafileServiceConnectionTest method onServiceConnected.
@Test
public void onServiceConnected() {
DatafileService.LocalBinder binder = mock(DatafileService.LocalBinder.class);
DatafileService service = mock(DatafileService.class);
Context context = mock(Context.class);
when(service.getApplicationContext()).thenReturn(context);
when(binder.getService()).thenReturn(service);
when(optimizelyManager.getDatafileConfig()).thenReturn(new DatafileConfig("1", (String) null));
when(optimizelyManager.getDatafileLoadedListener(context, null)).thenReturn(mock(DatafileLoadedListener.class));
ArgumentCaptor<DatafileLoadedListener> captor = ArgumentCaptor.forClass(DatafileLoadedListener.class);
datafileServiceConnection = new DatafileServiceConnection(optimizelyManager.getDatafileConfig(), context, optimizelyManager.getDatafileLoadedListener(context, null));
datafileServiceConnection.onServiceConnected(null, binder);
String sameString = optimizelyManager.getDatafileConfig().getUrl();
verify(service).getDatafile(eq(sameString), any(DatafileLoader.class), any(DatafileLoadedListener.class));
}
Aggregations