### Question:
ConstraintSecurityHandlerProvider implements Provider<ConstraintSecurityHandler> { @Override public ConstraintSecurityHandler get() { String contextPath = EmbeddedOozieServer.getContextPath(oozieConfiguration); ConstraintMapping callbackConstraintMapping = new ConstraintMapping(); callbackConstraintMapping.setPathSpec(String.format("%s/callback/*", contextPath)); Constraint unsecureConstraint = new Constraint(); unsecureConstraint.setDataConstraint(Constraint.DC_NONE); callbackConstraintMapping.setConstraint(unsecureConstraint); ConstraintMapping mapping = new ConstraintMapping(); mapping.setPathSpec("/*"); Constraint constraint = new Constraint(); constraint.setDataConstraint(Constraint.DC_CONFIDENTIAL); mapping.setConstraint(constraint); ConstraintSecurityHandler security = new ConstraintSecurityHandler(); security.setConstraintMappings(Arrays.asList(callbackConstraintMapping, mapping)); return security; } @Inject  ConstraintSecurityHandlerProvider(final Services oozieServices); @Override ConstraintSecurityHandler get();  }### Answer:
@Test public void constraintHandlersCanBeSet() { Configuration config = new Configuration(false); config.set("oozie.base.url", "https: when(mockCfgService.getConf()).thenReturn(config); when(mockServices.get(ConfigurationService.class)).thenReturn(mockCfgService); ConstraintSecurityHandlerProvider constraintSecurityHandlerProvider = new ConstraintSecurityHandlerProvider( mockServices); ConstraintSecurityHandler actConstraintSecurityHandler = constraintSecurityHandlerProvider.get(); List<ConstraintMapping> actConstraintMappings = actConstraintSecurityHandler.getConstraintMappings(); assertEquals(actConstraintMappings.size(), 2); List<String> actPathSpecs = new ArrayList<>(); for (ConstraintMapping sm : actConstraintMappings) { actPathSpecs.add(sm.getPathSpec()); } assertTrue(actPathSpecs.contains(String.format("%s/callback/*", EmbeddedOozieServer.getContextPath(config)))); assertTrue(actPathSpecs.contains("/*")); }