@Test(expected = DetectorException.class) public void testBuildDetector_illegalType() { val document = readDocument("invalid-type"); factoryUnderTest.buildDetector(document); }
public Detector buildDetector(DetectorDocument document) { notNull(document, "document can't be null"); val type = document.getType(); val factory = providers.get(type); if (factory == null) { throw new DetectorException("Illegal detector type: " + type); } return factory.buildDetector(document); }
DetectorFactory { public Detector buildDetector(DetectorDocument document) { notNull(document, "document can't be null"); val type = document.getType(); val factory = providers.get(type); if (factory == null) { throw new DetectorException("Illegal detector type: " + type); } return factory.buildDetector(document); } }
DetectorFactory { public Detector buildDetector(DetectorDocument document) { notNull(document, "document can't be null"); val type = document.getType(); val factory = providers.get(type); if (factory == null) { throw new DetectorException("Illegal detector type: " + type); } return factory.buildDetector(document); } DetectorFactory(); }
DetectorFactory { public Detector buildDetector(DetectorDocument document) { notNull(document, "document can't be null"); val type = document.getType(); val factory = providers.get(type); if (factory == null) { throw new DetectorException("Illegal detector type: " + type); } return factory.buildDetector(document); } DetectorFactory(); Detector buildDetector(DetectorDocument document); }
DetectorFactory { public Detector buildDetector(DetectorDocument document) { notNull(document, "document can't be null"); val type = document.getType(); val factory = providers.get(type); if (factory == null) { throw new DetectorException("Illegal detector type: " + type); } return factory.buildDetector(document); } DetectorFactory(); Detector buildDetector(DetectorDocument document);  }