### Question:
SwrveFirebaseMessagingService extends FirebaseMessagingService { @Override public void onNewToken(String token) { super.onNewToken(token); ISwrveBase sdk = SwrveSDK.getInstance(); if (sdk instanceof Swrve) { ((Swrve) sdk).setRegistrationId(token); } else { SwrveLogger.e("Could not notify the SDK of a new token."); } }  @Override void onNewToken(String token); @Override void onMessageReceived(RemoteMessage remoteMessage);  }### Answer:
@Test public void testOnNewToken() throws Exception { Swrve swrveSpy = Mockito.mock(Swrve.class); SwrveTestUtils.setSDKInstance(swrveSpy); SwrveFirebaseMessagingService service = Robolectric.setupService(SwrveFirebaseMessagingService.class); service.onCreate(); service.onNewToken("new_token"); ArgumentCaptor<String> stringCaptor = ArgumentCaptor.forClass(String.class); Mockito.verify(swrveSpy, Mockito.atLeastOnce()).setRegistrationId(stringCaptor.capture()); assertEquals("new_token", stringCaptor.getAllValues().get(0)); }