JobCoder { @NonNull Bundle encode(@NonNull JobParameters jobParameters, @NonNull Bundle data) { if (data == null) { throw new IllegalArgumentException("Unexpected null Bundle provided"); } Bundle userExtras = jobParameters.getExtras(); if (userExtras != null) { data.putAll(userExtras); } data.putInt(prefix + BundleProtocol.PACKED_PARAM_LIFETIME, jobParameters.getLifetime()); data.putBoolean(prefix + BundleProtocol.PACKED_PARAM_RECURRING, jobParameters.isRecurring()); data.putBoolean( prefix + BundleProtocol.PACKED_PARAM_REPLACE_CURRENT, jobParameters.shouldReplaceCurrent()); data.putString(prefix + BundleProtocol.PACKED_PARAM_TAG, jobParameters.getTag()); data.putString(prefix + BundleProtocol.PACKED_PARAM_SERVICE, jobParameters.getService()); data.putInt( prefix + BundleProtocol.PACKED_PARAM_CONSTRAINTS, compact(jobParameters.getConstraints())); encodeTrigger(jobParameters.getTrigger(), data); encodeRetryStrategy(jobParameters.getRetryStrategy(), data); return data; } JobCoder(String prefix); @Nullable JobInvocation.Builder decode(@NonNull Bundle providedBundle);  }
@Test(expected = IllegalArgumentException.class) public void testEncode_throwsOnNullBundle() { coder.encode(builder.build(), null); }