@Test public void parse_withValidArgument() throws Exception { ImapPushState result = ImapPushState.parse("uidNext=42"); assertNotNull(result); assertEquals(42L, result.uidNext); }
public static ImapPushState parse(String pushState) { if (pushState == null || !pushState.startsWith(PUSH_STATE_PREFIX)) { return createDefaultImapPushState(); } String value = pushState.substring(PUSH_STATE_PREFIX_LENGTH); try { long newUidNext = Long.parseLong(value); return new ImapPushState(newUidNext); } catch (NumberFormatException e) { Timber.e(e, "Unable to part uidNext value %s", value); } return createDefaultImapPushState(); }
ImapPushState { public static ImapPushState parse(String pushState) { if (pushState == null || !pushState.startsWith(PUSH_STATE_PREFIX)) { return createDefaultImapPushState(); } String value = pushState.substring(PUSH_STATE_PREFIX_LENGTH); try { long newUidNext = Long.parseLong(value); return new ImapPushState(newUidNext); } catch (NumberFormatException e) { Timber.e(e, "Unable to part uidNext value %s", value); } return createDefaultImapPushState(); } }
ImapPushState { public static ImapPushState parse(String pushState) { if (pushState == null || !pushState.startsWith(PUSH_STATE_PREFIX)) { return createDefaultImapPushState(); } String value = pushState.substring(PUSH_STATE_PREFIX_LENGTH); try { long newUidNext = Long.parseLong(value); return new ImapPushState(newUidNext); } catch (NumberFormatException e) { Timber.e(e, "Unable to part uidNext value %s", value); } return createDefaultImapPushState(); } ImapPushState(long uidNext); }
ImapPushState { public static ImapPushState parse(String pushState) { if (pushState == null || !pushState.startsWith(PUSH_STATE_PREFIX)) { return createDefaultImapPushState(); } String value = pushState.substring(PUSH_STATE_PREFIX_LENGTH); try { long newUidNext = Long.parseLong(value); return new ImapPushState(newUidNext); } catch (NumberFormatException e) { Timber.e(e, "Unable to part uidNext value %s", value); } return createDefaultImapPushState(); } ImapPushState(long uidNext); static ImapPushState parse(String pushState); @Override String toString(); }
ImapPushState { public static ImapPushState parse(String pushState) { if (pushState == null || !pushState.startsWith(PUSH_STATE_PREFIX)) { return createDefaultImapPushState(); } String value = pushState.substring(PUSH_STATE_PREFIX_LENGTH); try { long newUidNext = Long.parseLong(value); return new ImapPushState(newUidNext); } catch (NumberFormatException e) { Timber.e(e, "Unable to part uidNext value %s", value); } return createDefaultImapPushState(); } ImapPushState(long uidNext); static ImapPushState parse(String pushState); @Override String toString(); final long uidNext; }