@Test(expected = NotSerializableException.class)
  public void testCloneWithSerializationError() throws Throwable {
    OperatorSpec mockFailedOpSpec = PowerMockito.mock(OperatorSpec.class);
    when(mockFailedOpSpec.getOpId()).thenReturn("test-failed-op-4");
    allOpSpecs.add(mockFailedOpSpec);
    inputOpSpecMap.values().stream().findFirst().get().registerNextOperatorSpec(mockFailedOpSpec);

    //failed with serialization error
    try {
      new OperatorSpecGraph(mockAppDesc);
      fail("Should have failed with serialization error");
    } catch (SamzaException se) {
      throw se.getCause();
    }
  }
Setup two linear transformation pipelines:
1) input1 --> filter --> sendTo
2) input2 --> map --> sink
samza-core/src/test/java/org/apache/samza/operators/TestOperatorSpecGraph.java