@Test @SmallTest public void toStateBundle() { KeyedAppState keyedAppState = KeyedAppState.builder() .setKey(KEY) .setMessage(MESSAGE) .setSeverity(SEVERITY) .setData(DATA) .build(); Bundle bundle = keyedAppState.toStateBundle(); assertThat(bundle.getString(APP_STATE_KEY)).isEqualTo(KEY); assertThat(bundle.getString(APP_STATE_MESSAGE)).isEqualTo(MESSAGE); assertThat(bundle.getInt(APP_STATE_SEVERITY)).isEqualTo(SEVERITY); assertThat(bundle.getString(APP_STATE_DATA)).isEqualTo(DATA); }
Bundle toStateBundle() { Bundle bundle = new Bundle(); bundle.putString(APP_STATE_KEY, getKey()); bundle.putInt(APP_STATE_SEVERITY, getSeverity()); if (getMessage() != null) { bundle.putString(APP_STATE_MESSAGE, getMessage()); } if (getData() != null) { bundle.putString(APP_STATE_DATA, getData()); } return bundle; }
KeyedAppState { Bundle toStateBundle() { Bundle bundle = new Bundle(); bundle.putString(APP_STATE_KEY, getKey()); bundle.putInt(APP_STATE_SEVERITY, getSeverity()); if (getMessage() != null) { bundle.putString(APP_STATE_MESSAGE, getMessage()); } if (getData() != null) { bundle.putString(APP_STATE_DATA, getData()); } return bundle; } }
KeyedAppState { Bundle toStateBundle() { Bundle bundle = new Bundle(); bundle.putString(APP_STATE_KEY, getKey()); bundle.putInt(APP_STATE_SEVERITY, getSeverity()); if (getMessage() != null) { bundle.putString(APP_STATE_MESSAGE, getMessage()); } if (getData() != null) { bundle.putString(APP_STATE_DATA, getData()); } return bundle; } KeyedAppState(); }
KeyedAppState { Bundle toStateBundle() { Bundle bundle = new Bundle(); bundle.putString(APP_STATE_KEY, getKey()); bundle.putInt(APP_STATE_SEVERITY, getSeverity()); if (getMessage() != null) { bundle.putString(APP_STATE_MESSAGE, getMessage()); } if (getData() != null) { bundle.putString(APP_STATE_DATA, getData()); } return bundle; } KeyedAppState(); @NonNull static KeyedAppStateBuilder builder(); @NonNull abstract String getKey(); @Severity abstract int getSeverity(); @Nullable abstract String getMessage(); @Nullable abstract String getData(); }
KeyedAppState { Bundle toStateBundle() { Bundle bundle = new Bundle(); bundle.putString(APP_STATE_KEY, getKey()); bundle.putInt(APP_STATE_SEVERITY, getSeverity()); if (getMessage() != null) { bundle.putString(APP_STATE_MESSAGE, getMessage()); } if (getData() != null) { bundle.putString(APP_STATE_DATA, getData()); } return bundle; } KeyedAppState(); @NonNull static KeyedAppStateBuilder builder(); @NonNull abstract String getKey(); @Severity abstract int getSeverity(); @Nullable abstract String getMessage(); @Nullable abstract String getData(); static final int SEVERITY_INFO; static final int SEVERITY_ERROR; static final int MAX_KEY_LENGTH; static final int MAX_MESSAGE_LENGTH; static final int MAX_DATA_LENGTH; }