EdmxDetectorFactoryProvider implements DetectorFactoryProvider<EdmxDetector> { @Override public EdmxDetector buildDetector(DetectorDocument document) { notNull(document, "document can't be null"); val hyperparamsMap = document.getConfig().get("hyperparams"); val hyperparams = objectMapper.convertValue(hyperparamsMap, EdmxHyperparams.class); val trusted = document.isTrusted(); return new EdmxDetector(document.getUuid(), hyperparams, trusted); }  @Override EdmxDetector buildDetector(DetectorDocument document);  }
@Test public void testBuildDetector() { val factoryUnderTest = new EdmxDetectorFactoryProvider(); val document = readDocument("edmx"); val detector = factoryUnderTest.buildDetector(document); val hyperparams = detector.getHyperparams(); assertNotNull(detector); assertEquals("9d934a88-f89b-4793-956a-bede72c3081f", detector.getUuid().toString()); assertEquals(EdmxDetector.class, detector.getClass()); assertEquals(24, hyperparams.getBufferSize()); assertEquals(6, hyperparams.getDelta()); assertEquals(199, hyperparams.getNumPerms()); assertEquals(0.01, hyperparams.getStrongAlpha(), TOLERANCE); assertEquals(0.05, hyperparams.getWeakAlpha(), TOLERANCE); }
@Test(expected = RuntimeException.class) public void testBuild_invalidHyperparams() { val factoryUnderTest = new EdmxDetectorFactoryProvider(); val document = readDocument("edmx-invalid-hyperparams"); factoryUnderTest.buildDetector(document); }