use of org.infobip.mobile.messaging.api.version.MobileApiVersion in project mobile-messaging-sdk-android by infobip.
the class MobileApiResourceProviderTest method shouldUseNewUrlForSecondRequest.
@Test
public void shouldUseNewUrlForSecondRequest() {
// given
debugServer.respondWith(NanoHTTPD.Response.Status.OK, null, new HashMap<String, String>() {
{
put(CustomApiHeaders.NEW_BASE_URL.getValue(), "http://customurl");
}
});
MobileApiVersion givenMobileApiVersion = mobileApiResourceProvider.getMobileApiVersion(context);
// when
givenMobileApiVersion.getLatestRelease();
try {
givenMobileApiVersion.getLatestRelease();
assertTrue(false);
} catch (ApiIOException e) {
assertTrue(e.getCause() instanceof UnknownHostException);
assertTrue(e.getCause().getMessage().contains("customurl"));
}
}
use of org.infobip.mobile.messaging.api.version.MobileApiVersion in project mobile-messaging-sdk-android by infobip.
the class MobileApiVersionTest method setUp.
@Before
public void setUp() throws Exception {
debugServer = new DebugServer();
debugServer.start();
Properties properties = new Properties();
properties.put("api.key", "my_API_key");
Generator generator = new Generator.Builder().withBaseUrl("http://127.0.0.1:" + debugServer.getListeningPort() + "/").withProperties(properties).build();
mobileApiVersion = generator.create(MobileApiVersion.class);
}
Aggregations