@Test(expected = SamzaException.class)
  public void testStreamProcessorWithNoTask() {
    final String testSystem = "test-system";
    final String inputTopic = "numbers4";
    final String outputTopic = "output4";
    final int messageCount = 20;

    final Map<String, String> configMap = createConfigs(PROCESSOR_ID, testSystem, inputTopic, outputTopic, messageCount);
    configMap.remove("task.class");
    final Config configs = new MapConfig(configMap);
    final TestStubs stubs = new TestStubs(configs, (StreamTaskFactory) null, bootstrapServers());

    run(stubs.processor, stubs.shutdownLatch);
  }
Should fail to create a SamzaContainer when neither task factory nor task.class are provided.
samza-test/src/test/java/org/apache/samza/test/processor/TestStreamProcessor.java