Navigator { public void navigateToServerFoundActivity(Activity activity, final ServerModel serverModel) { checkValidActivity(activity); if (serverModel == null) { throw new IllegalArgumentException("Cannot navigate using a null ServerModel."); } Intent intentToLaunch = ServerFoundActivity.getCallingIntent(activity, serverModel); startActivityForResult(activity, intentToLaunch, RequestCode.SERVER_FOUND); } @Inject  Navigator(); void finishActivity(Activity activity, boolean isSuccess,
      String extraKey, T extra); void finishActivity(Activity activity, boolean isSuccess,
      Map<String, T> extras); void finishActivity(Activity activity); void navigateToServerSearchActivity(Context context); void navigateToServerFoundActivity(Activity activity, final ServerModel serverModel);  }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionNavigatingToServerFoundActivityGivenNullActivity() throws Exception { ServerModel serverModel = ServerModel.builder() .ssid("WLAN_C33") .ip("192.168.1.34") .hostname("iMac") .os("macOS") .version("1.48") .seed("34640505599934") .worldName("Reign of Giants") .playerName("Etho") .encodedWorldImage("base64image") .build(); navigator.navigateToServerFoundActivity(null, serverModel); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionNavigatingToServerFoundActivityGivenNullServerModel() throws Exception { navigator.navigateToServerFoundActivity(mockActivity, null); }