use of com.google.firebase.perf.util.URLWrapper in project firebase-android-sdk by firebase.
the class FirebasePerfUrlConnectionTest method testGetContentError.
@Test
public void testGetContentError() throws IOException {
URLWrapper wrapper = mock(URLWrapper.class);
when(wrapper.toString()).thenReturn("www.google.com");
when(wrapper.openConnection()).thenThrow(IOException.class);
try {
FirebasePerfUrlConnection.getContent(wrapper, transportManager, timer);
fail("expected IOException");
} catch (IOException e) {
verify(transportManager).log(networkArgumentCaptor.capture(), ArgumentMatchers.any(ApplicationProcessState.class));
NetworkRequestMetric metric = networkArgumentCaptor.getValue();
verifyNetworkRequestMetric(metric);
}
}
use of com.google.firebase.perf.util.URLWrapper in project firebase-android-sdk by firebase.
the class FirebasePerfUrlConnectionTest method testOpenStreamHttpConnectionError.
@Test
public void testOpenStreamHttpConnectionError() throws IOException {
URLWrapper wrapper = mock(URLWrapper.class);
when(wrapper.toString()).thenReturn("www.google.com");
when(wrapper.openConnection()).thenThrow(IOException.class);
try {
FirebasePerfUrlConnection.openStream(wrapper, transportManager, timer);
fail("expected IOException");
} catch (IOException e) {
verify(transportManager).log(networkArgumentCaptor.capture(), ArgumentMatchers.any(ApplicationProcessState.class));
NetworkRequestMetric metric = networkArgumentCaptor.getValue();
verifyNetworkRequestMetric(metric);
}
}
use of com.google.firebase.perf.util.URLWrapper in project firebase-android-sdk by firebase.
the class FirebasePerfUrlConnectionTest method testGetContentClasses.
@Test
public void testGetContentClasses() throws IOException {
@SuppressWarnings("rawtypes") Class[] classes = { TransportManager.class };
URLWrapper wrapper = mock(URLWrapper.class);
when(wrapper.toString()).thenReturn("www.google.com");
when(wrapper.openConnection()).thenThrow(IOException.class);
try {
FirebasePerfUrlConnection.getContent(wrapper, classes, transportManager, timer);
fail("expected IOException");
} catch (IOException e) {
verify(transportManager).log(networkArgumentCaptor.capture(), ArgumentMatchers.any(ApplicationProcessState.class));
NetworkRequestMetric metric = networkArgumentCaptor.getValue();
verifyNetworkRequestMetric(metric);
}
}
Aggregations