PurposeUseProxyDefaultImpl implements PurposeUseProxy { public boolean isPurposeForUseEnabled() { LOG.info("Entering PurposeUseProxyDefaultImpl.isPurposeForUseEnabled..."); boolean match = false; try { String purposeForUseEnabled = propertyAccessor.getProperty(NhincConstants.GATEWAY_PROPERTY_FILE, PURPOSE_FOR_USE_DEPRECATED_ENABLED); if (purposeForUseEnabled != null && purposeForUseEnabled.equalsIgnoreCase("true")) { match = true; } } catch (PropertyAccessException ex) { LOG.error("Error: Failed to retrieve {} from property file {}: {}", PURPOSE_FOR_USE_DEPRECATED_ENABLED, NhincConstants.GATEWAY_PROPERTY_FILE, ex.getLocalizedMessage(), ex); } return match; } PurposeUseProxyDefaultImpl(IPropertyAcessor propertyAccessor);  PurposeUseProxyDefaultImpl(); boolean isPurposeForUseEnabled(); @Override boolean isPurposeForUseEnabled(CallbackProperties callbackProperties);  }
@Test public void testPurposeForEnabled() throws PropertyAccessException { PurposeUseProxy testPurposeUseProxy = new PurposeUseProxyDefaultImpl(mockPropertyAccessor); setPropertyExpectation(Expectations.returnValue("true"), NhincConstants.GATEWAY_PROPERTY_FILE, "purposeForUseEnabled"); Assert.assertTrue(testPurposeUseProxy.isPurposeForUseEnabled(null)); }
@Test public void testPurposeForDisabled() throws PropertyAccessException { PurposeUseProxy testPurposeUseProxy = new PurposeUseProxyDefaultImpl(mockPropertyAccessor); setPropertyExpectation(Expectations.returnValue("false"), NhincConstants.GATEWAY_PROPERTY_FILE, "purposeForUseEnabled"); Assert.assertFalse(testPurposeUseProxy.isPurposeForUseEnabled(null)); }
@Test public void testPurposeForDisabledWhenNull() throws PropertyAccessException { PurposeUseProxy testPurposeUseProxy = new PurposeUseProxyDefaultImpl(mockPropertyAccessor); setPropertyExpectation(Expectations.returnValue(null), NhincConstants.GATEWAY_PROPERTY_FILE, "purposeForUseEnabled"); Assert.assertFalse(testPurposeUseProxy.isPurposeForUseEnabled(null)); }