### Question:
SystemMetrics implements Serializable { public abstract T diff(@Nullable T b, @Nullable T output);  abstract T sum(@Nullable T b, @Nullable T output); abstract T diff(@Nullable T b, @Nullable T output); abstract T set(T b); T sum(@Nullable T b); T diff(@Nullable T b);  }### Answer:
@Test public void testDiff() throws Exception { T a = createInitializedInstance(); T b = createInitializedInstance(); T diff = createInitializedInstance(); int index = 1; for (Field field : getClazz().getFields()) { if (MetricsUtil.isNumericField(field)) { field.set(a, 2 * index); index += 1; } } a.diff(b, diff); int increment = 1; for (Field field : getClazz().getFields()) { if (MetricsUtil.isNumericField(field)) { MetricsUtil.testValue(diff, field, increment); increment += 1; } } }
@Test public void testNullOutput() throws Exception { T instanceA = createInitializedInstance(); T instanceB = createInitializedInstance(); T diff = instanceA.diff(instanceB, null); assertThat(diff).isNotNull(); }
@Test public void testNullSubtrahend() throws Exception { T instanceA = createInitializedInstance(); T diff = createInitializedInstance(); instanceA.diff(null, diff); assertThat(instanceA).isEqualTo(diff); }