target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testContentTypesWhenNeedsSplitWithWhitespace() { when(req.getHeaders(ACCEPT_HEADER)).thenReturn( enumeration(asList("text/html, application/xhtml+xml, application/xml;q=0.9"))); assertEquals(asList("text/html", "application/xhtml+xml", "application/xml;q=0.9"), contentNegotiator.contentTypes()); } | @Override public List<String> contentTypes() { List<String> contentTypes = null; final HttpServletRequest request = getHttpRequest(); if (favorParameterOverAcceptHeader) { contentTypes = getFavoredParameterValueAsList(request); } else { contentTypes = getAcceptHeaderValues(request); } if (isEmpty(contentTypes)) { logge... | DefaultContentNegotiator implements ContentNegotiator { @Override public List<String> contentTypes() { List<String> contentTypes = null; final HttpServletRequest request = getHttpRequest(); if (favorParameterOverAcceptHeader) { contentTypes = getFavoredParameterValueAsList(request); } else { contentTypes = getAcceptHea... | DefaultContentNegotiator implements ContentNegotiator { @Override public List<String> contentTypes() { List<String> contentTypes = null; final HttpServletRequest request = getHttpRequest(); if (favorParameterOverAcceptHeader) { contentTypes = getFavoredParameterValueAsList(request); } else { contentTypes = getAcceptHea... | DefaultContentNegotiator implements ContentNegotiator { @Override public List<String> contentTypes() { List<String> contentTypes = null; final HttpServletRequest request = getHttpRequest(); if (favorParameterOverAcceptHeader) { contentTypes = getFavoredParameterValueAsList(request); } else { contentTypes = getAcceptHea... | DefaultContentNegotiator implements ContentNegotiator { @Override public List<String> contentTypes() { List<String> contentTypes = null; final HttpServletRequest request = getHttpRequest(); if (favorParameterOverAcceptHeader) { contentTypes = getFavoredParameterValueAsList(request); } else { contentTypes = getAcceptHea... |
@Test public void debugDefault() throws Exception { Assert.assertFalse("debug should be off", defaultTofuCompiler.isHotReloadMode()); } | public boolean isHotReloadMode() { return hotReloadMode; } | DefaultTofuCompiler implements TofuCompiler { public boolean isHotReloadMode() { return hotReloadMode; } } | DefaultTofuCompiler implements TofuCompiler { public boolean isHotReloadMode() { return hotReloadMode; } } | DefaultTofuCompiler implements TofuCompiler { public boolean isHotReloadMode() { return hotReloadMode; } @Override SoyTofu compile(@Nullable final Collection<URL> urls); @Override final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle); @Override Collection<String> com... | DefaultTofuCompiler implements TofuCompiler { public boolean isHotReloadMode() { return hotReloadMode; } @Override SoyTofu compile(@Nullable final Collection<URL> urls); @Override final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle); @Override Collection<String> com... |
@Test public void testSoyJsSrcOptionsNotNull() throws Exception { Assert.assertNotNull(defaultTofuCompiler.getSoyJsSrcOptions()); } | public SoyJsSrcOptions getSoyJsSrcOptions() { return soyJsSrcOptions; } | DefaultTofuCompiler implements TofuCompiler { public SoyJsSrcOptions getSoyJsSrcOptions() { return soyJsSrcOptions; } } | DefaultTofuCompiler implements TofuCompiler { public SoyJsSrcOptions getSoyJsSrcOptions() { return soyJsSrcOptions; } } | DefaultTofuCompiler implements TofuCompiler { public SoyJsSrcOptions getSoyJsSrcOptions() { return soyJsSrcOptions; } @Override SoyTofu compile(@Nullable final Collection<URL> urls); @Override final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle); @Override Collectio... | DefaultTofuCompiler implements TofuCompiler { public SoyJsSrcOptions getSoyJsSrcOptions() { return soyJsSrcOptions; } @Override SoyTofu compile(@Nullable final Collection<URL> urls); @Override final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle); @Override Collectio... |
@Test public void testCompileSoyToBinaryWithEmptyCompileTimeModel() throws Exception { when(compileTimeGlobalModelResolver.resolveData()).thenReturn(Optional.<SoyMapData>absent()); final URL template1 = getClass().getClassLoader().getResource("templates/template1.soy"); final SoyTofu tofu = defaultTofuCompiler.compile(... | @Override public SoyTofu compile(@Nullable final Collection<URL> urls) throws IOException { Preconditions.checkNotNull("compileTimeGlobalModelResolver", compileTimeGlobalModelResolver); if (urls == null || urls.isEmpty()) { throw new IOException("Unable to compile, no urls found"); } logger.debug("SoyTofu compilation o... | DefaultTofuCompiler implements TofuCompiler { @Override public SoyTofu compile(@Nullable final Collection<URL> urls) throws IOException { Preconditions.checkNotNull("compileTimeGlobalModelResolver", compileTimeGlobalModelResolver); if (urls == null || urls.isEmpty()) { throw new IOException("Unable to compile, no urls ... | DefaultTofuCompiler implements TofuCompiler { @Override public SoyTofu compile(@Nullable final Collection<URL> urls) throws IOException { Preconditions.checkNotNull("compileTimeGlobalModelResolver", compileTimeGlobalModelResolver); if (urls == null || urls.isEmpty()) { throw new IOException("Unable to compile, no urls ... | DefaultTofuCompiler implements TofuCompiler { @Override public SoyTofu compile(@Nullable final Collection<URL> urls) throws IOException { Preconditions.checkNotNull("compileTimeGlobalModelResolver", compileTimeGlobalModelResolver); if (urls == null || urls.isEmpty()) { throw new IOException("Unable to compile, no urls ... | DefaultTofuCompiler implements TofuCompiler { @Override public SoyTofu compile(@Nullable final Collection<URL> urls) throws IOException { Preconditions.checkNotNull("compileTimeGlobalModelResolver", compileTimeGlobalModelResolver); if (urls == null || urls.isEmpty()) { throw new IOException("Unable to compile, no urls ... |
@Test public void testDefault() throws Exception { Assert.assertTrue("should allow all", permissableAuthManager.isAllowed("template")); } | @Override public boolean isAllowed(String url) { return true; } | PermissableAuthManager implements AuthManager { @Override public boolean isAllowed(String url) { return true; } } | PermissableAuthManager implements AuthManager { @Override public boolean isAllowed(String url) { return true; } } | PermissableAuthManager implements AuthManager { @Override public boolean isAllowed(String url) { return true; } @Override boolean isAllowed(String url); } | PermissableAuthManager implements AuthManager { @Override public boolean isAllowed(String url) { return true; } @Override boolean isAllowed(String url); } |
@Test public void testCompileSoyToJsWithCompileTimeModel() throws Exception { final SoyMapData soyMapData = new SoyMapData(); soyMapData.put("test1", "test2"); when(compileTimeGlobalModelResolver.resolveData()).thenReturn(Optional.of(soyMapData)); final URL template1 = getClass().getClassLoader().getResource("templates... | @Override public SoyTofu compile(@Nullable final Collection<URL> urls) throws IOException { Preconditions.checkNotNull("compileTimeGlobalModelResolver", compileTimeGlobalModelResolver); if (urls == null || urls.isEmpty()) { throw new IOException("Unable to compile, no urls found"); } logger.debug("SoyTofu compilation o... | DefaultTofuCompiler implements TofuCompiler { @Override public SoyTofu compile(@Nullable final Collection<URL> urls) throws IOException { Preconditions.checkNotNull("compileTimeGlobalModelResolver", compileTimeGlobalModelResolver); if (urls == null || urls.isEmpty()) { throw new IOException("Unable to compile, no urls ... | DefaultTofuCompiler implements TofuCompiler { @Override public SoyTofu compile(@Nullable final Collection<URL> urls) throws IOException { Preconditions.checkNotNull("compileTimeGlobalModelResolver", compileTimeGlobalModelResolver); if (urls == null || urls.isEmpty()) { throw new IOException("Unable to compile, no urls ... | DefaultTofuCompiler implements TofuCompiler { @Override public SoyTofu compile(@Nullable final Collection<URL> urls) throws IOException { Preconditions.checkNotNull("compileTimeGlobalModelResolver", compileTimeGlobalModelResolver); if (urls == null || urls.isEmpty()) { throw new IOException("Unable to compile, no urls ... | DefaultTofuCompiler implements TofuCompiler { @Override public SoyTofu compile(@Nullable final Collection<URL> urls) throws IOException { Preconditions.checkNotNull("compileTimeGlobalModelResolver", compileTimeGlobalModelResolver); if (urls == null || urls.isEmpty()) { throw new IOException("Unable to compile, no urls ... |
@Test public void testCompileSoyToJsWithEmptyCompileTimeModel() throws Exception { when(compileTimeGlobalModelResolver.resolveData()).thenReturn(Optional.<SoyMapData>absent()); final URL template1 = getClass().getClassLoader().getResource("templates/template1.soy"); final Collection<String> tofu = defaultTofuCompiler.c... | @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if (compiledTemplates.isEmpty()) { return Option... | DefaultTofuCompiler implements TofuCompiler { @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if... | DefaultTofuCompiler implements TofuCompiler { @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if... | DefaultTofuCompiler implements TofuCompiler { @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if... | DefaultTofuCompiler implements TofuCompiler { @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if... |
@Test public void testCompileSoyToBinaryWithCompileTimeModel() throws Exception { final SoyMapData soyMapData = new SoyMapData(); soyMapData.put("test1", "test2"); when(compileTimeGlobalModelResolver.resolveData()).thenReturn(Optional.of(soyMapData)); when(compileTimeGlobalModelResolver.resolveData()).thenReturn(Option... | @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if (compiledTemplates.isEmpty()) { return Option... | DefaultTofuCompiler implements TofuCompiler { @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if... | DefaultTofuCompiler implements TofuCompiler { @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if... | DefaultTofuCompiler implements TofuCompiler { @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if... | DefaultTofuCompiler implements TofuCompiler { @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if... |
@Test public void testCompileSoyToBinaryWithCompileTimeModelAndSoyMsgBundle() throws Exception { final String compiledJs = " " "\n" + "\n" + "\n" + "if (typeof soy == 'undefined') { var soy = {}; }\n" + "if (typeof soy.example == 'undefined') { soy.example = {}; }\n" + "\n" + "\n" + "soy.example.test = function(opt_dat... | @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if (compiledTemplates.isEmpty()) { return Option... | DefaultTofuCompiler implements TofuCompiler { @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if... | DefaultTofuCompiler implements TofuCompiler { @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if... | DefaultTofuCompiler implements TofuCompiler { @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if... | DefaultTofuCompiler implements TofuCompiler { @Override public final Optional<String> compileToJsSrc(@Nullable final URL url, @Nullable final SoyMsgBundle soyMsgBundle) { if (url == null) { return Optional.absent(); } final Collection<String> compiledTemplates = compileToJsSrc(Lists.newArrayList(url), soyMsgBundle); if... |
@Test public void testBindCookies() throws Exception { final SoyMapData soyMapData = new SoyMapData(); final HttpServletRequest request = mock(HttpServletRequest.class); final HttpServletResponse response = mock(HttpServletResponse.class); final Enumeration e = mock(Enumeration.class); when(e.hasMoreElements()).thenRet... | @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) { if (request.getCookies() == null) { logger.debug("no cookies!"); return; } for (final Cookie cookie : request.getCookies()) { if (StringUtils.hasLen... | CookieDataResolver implements RuntimeDataResolver { @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) { if (request.getCookies() == null) { logger.debug("no cookies!"); return; } for (final Cookie coo... | CookieDataResolver implements RuntimeDataResolver { @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) { if (request.getCookies() == null) { logger.debug("no cookies!"); return; } for (final Cookie coo... | CookieDataResolver implements RuntimeDataResolver { @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) { if (request.getCookies() == null) { logger.debug("no cookies!"); return; } for (final Cookie coo... | CookieDataResolver implements RuntimeDataResolver { @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) { if (request.getCookies() == null) { logger.debug("no cookies!"); return; } for (final Cookie coo... |
@Test public void resolveRequestParameters() throws Exception { final SoyMapData soyMapData = new SoyMapData(); final Vector<String> names = new Vector<String>(); names.add("name1"); names.add("name2"); final Vector<String> values = new Vector<String>(); values.add("value1"); values.add("value2"); final HttpServletRequ... | @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) { for (final Enumeration e = request.getParameterNames(); e.hasMoreElements();) { final String paramName = (String) e.nextElement(); final String para... | RequestParametersDataResolver implements RuntimeDataResolver { @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) { for (final Enumeration e = request.getParameterNames(); e.hasMoreElements();) { final... | RequestParametersDataResolver implements RuntimeDataResolver { @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) { for (final Enumeration e = request.getParameterNames(); e.hasMoreElements();) { final... | RequestParametersDataResolver implements RuntimeDataResolver { @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) { for (final Enumeration e = request.getParameterNames(); e.hasMoreElements();) { final... | RequestParametersDataResolver implements RuntimeDataResolver { @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, final Map<String, ? extends Object> model, final SoyMapData root) { for (final Enumeration e = request.getParameterNames(); e.hasMoreElements();) { final... |
@Test public void testResolverHeaders() throws Exception { final SoyMapData soyMapData = new SoyMapData(); final Vector<String> names = new Vector<String>(); names.add("name1"); names.add("name2"); final Vector<String> values = new Vector<String>(); values.add("value1"); values.add("value2"); final HttpServletRequest r... | @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, Map<String, ? extends Object> model, final SoyMapData root) { for (final Enumeration e = request.getHeaderNames(); e.hasMoreElements();) { final String headerName = (String) e.nextElement(); final String requestHeade... | RequestHeadersDataResolver implements RuntimeDataResolver { @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, Map<String, ? extends Object> model, final SoyMapData root) { for (final Enumeration e = request.getHeaderNames(); e.hasMoreElements();) { final String head... | RequestHeadersDataResolver implements RuntimeDataResolver { @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, Map<String, ? extends Object> model, final SoyMapData root) { for (final Enumeration e = request.getHeaderNames(); e.hasMoreElements();) { final String head... | RequestHeadersDataResolver implements RuntimeDataResolver { @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, Map<String, ? extends Object> model, final SoyMapData root) { for (final Enumeration e = request.getHeaderNames(); e.hasMoreElements();) { final String head... | RequestHeadersDataResolver implements RuntimeDataResolver { @Override public void resolveData(final HttpServletRequest request, final HttpServletResponse response, Map<String, ? extends Object> model, final SoyMapData root) { for (final Enumeration e = request.getHeaderNames(); e.hasMoreElements();) { final String head... |
@Test public void notNull() throws Exception { Assert.assertNotNull("not null", defaultCompileTimeGlobalModelResolver.resolveData()); } | public Optional<SoyMapData> resolveData() { return Optional.absent(); } | EmptyCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { public Optional<SoyMapData> resolveData() { return Optional.absent(); } } | EmptyCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { public Optional<SoyMapData> resolveData() { return Optional.absent(); } } | EmptyCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { public Optional<SoyMapData> resolveData() { return Optional.absent(); } Optional<SoyMapData> resolveData(); } | EmptyCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { public Optional<SoyMapData> resolveData() { return Optional.absent(); } Optional<SoyMapData> resolveData(); } |
@Test public void absent() throws Exception { Assert.assertFalse("should be absent", defaultCompileTimeGlobalModelResolver.resolveData().isPresent()); } | public Optional<SoyMapData> resolveData() { return Optional.absent(); } | EmptyCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { public Optional<SoyMapData> resolveData() { return Optional.absent(); } } | EmptyCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { public Optional<SoyMapData> resolveData() { return Optional.absent(); } } | EmptyCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { public Optional<SoyMapData> resolveData() { return Optional.absent(); } Optional<SoyMapData> resolveData(); } | EmptyCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { public Optional<SoyMapData> resolveData() { return Optional.absent(); } Optional<SoyMapData> resolveData(); } |
@Test public void defaultNotNull() throws Exception { Assert.assertNotNull("by default not null", defaultCompileTimeGlobalModelResolver.resolveData()); } | @Override public Optional<SoyMapData> resolveData() { if (data == null || data.isEmpty()) { return Optional.absent(); } return Optional.of(new SoyMapData(data)); } | DefaultCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { @Override public Optional<SoyMapData> resolveData() { if (data == null || data.isEmpty()) { return Optional.absent(); } return Optional.of(new SoyMapData(data)); } } | DefaultCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { @Override public Optional<SoyMapData> resolveData() { if (data == null || data.isEmpty()) { return Optional.absent(); } return Optional.of(new SoyMapData(data)); } } | DefaultCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { @Override public Optional<SoyMapData> resolveData() { if (data == null || data.isEmpty()) { return Optional.absent(); } return Optional.of(new SoyMapData(data)); } @Override Optional<SoyMapData> resolveData(); void setData(final Map data... | DefaultCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { @Override public Optional<SoyMapData> resolveData() { if (data == null || data.isEmpty()) { return Optional.absent(); } return Optional.of(new SoyMapData(data)); } @Override Optional<SoyMapData> resolveData(); void setData(final Map data... |
@Test public void testDebugByDefault() throws Exception { Assert.assertFalse("debug should be off by default", hashFileGenerator.isHotReloadMode()); } | public boolean isHotReloadMode() { return hotReloadMode; } | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public boolean isHotReloadMode() { return hotReloadMode; } } | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public boolean isHotReloadMode() { return hotReloadMode; } } | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public boolean isHotReloadMode() { return hotReloadMode; } void afterPropertiesSet(); @Override Optional<String> hash(final Optional<URL> url); @Override Optional<String> hashMulti(final Collection<URL> urls); static String getMD5Checksum(final Inpu... | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public boolean isHotReloadMode() { return hotReloadMode; } void afterPropertiesSet(); @Override Optional<String> hash(final Optional<URL> url); @Override Optional<String> hashMulti(final Collection<URL> urls); static String getMD5Checksum(final Inpu... |
@Test public void defaultAbsent() throws Exception { Assert.assertFalse("by default there is no data - returns absent", defaultCompileTimeGlobalModelResolver.resolveData().isPresent()); } | @Override public Optional<SoyMapData> resolveData() { if (data == null || data.isEmpty()) { return Optional.absent(); } return Optional.of(new SoyMapData(data)); } | DefaultCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { @Override public Optional<SoyMapData> resolveData() { if (data == null || data.isEmpty()) { return Optional.absent(); } return Optional.of(new SoyMapData(data)); } } | DefaultCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { @Override public Optional<SoyMapData> resolveData() { if (data == null || data.isEmpty()) { return Optional.absent(); } return Optional.of(new SoyMapData(data)); } } | DefaultCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { @Override public Optional<SoyMapData> resolveData() { if (data == null || data.isEmpty()) { return Optional.absent(); } return Optional.of(new SoyMapData(data)); } @Override Optional<SoyMapData> resolveData(); void setData(final Map data... | DefaultCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { @Override public Optional<SoyMapData> resolveData() { if (data == null || data.isEmpty()) { return Optional.absent(); } return Optional.of(new SoyMapData(data)); } @Override Optional<SoyMapData> resolveData(); void setData(final Map data... |
@Test public void setProperties() throws Exception { final Properties properties = new Properties(); properties.setProperty("key1", "value1"); properties.setProperty("key2", "value2"); properties.setProperty("key3", "value3"); defaultCompileTimeGlobalModelResolver.setProperties(properties); Assert.assertEquals("after s... | public void setProperties(final Properties properties) { data = new HashMap(); for (final String propertyName : properties.stringPropertyNames()) { data.put(propertyName, properties.getProperty(propertyName)); } } | DefaultCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { public void setProperties(final Properties properties) { data = new HashMap(); for (final String propertyName : properties.stringPropertyNames()) { data.put(propertyName, properties.getProperty(propertyName)); } } } | DefaultCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { public void setProperties(final Properties properties) { data = new HashMap(); for (final String propertyName : properties.stringPropertyNames()) { data.put(propertyName, properties.getProperty(propertyName)); } } } | DefaultCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { public void setProperties(final Properties properties) { data = new HashMap(); for (final String propertyName : properties.stringPropertyNames()) { data.put(propertyName, properties.getProperty(propertyName)); } } @Override Optional<SoyM... | DefaultCompileTimeGlobalModelResolver implements CompileTimeGlobalModelResolver { public void setProperties(final Properties properties) { data = new HashMap(); for (final String propertyName : properties.stringPropertyNames()) { data.put(propertyName, properties.getProperty(propertyName)); } } @Override Optional<SoyM... |
@Test public void defaultDebugFlag() throws Exception { Assert.assertFalse("debug flag should be off", templateFilesResolver.isHotReloadMode()); } | public boolean isHotReloadMode() { return hotReloadMode; } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public boolean isHotReloadMode() { return hotReloadMode; } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public boolean isHotReloadMode() { return hotReloadMode; } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public boolean isHotReloadMode() { return hotReloadMode; } @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nullable String templateFileName); void setTemplatesLocation(St... | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public boolean isHotReloadMode() { return hotReloadMode; } @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nullable String templateFileName); void setTemplatesLocation(St... |
@Test public void defaultRecursive() throws Exception { Assert.assertTrue("recursive template file resolution should be on", templateFilesResolver.isRecursive()); } | public boolean isRecursive() { return recursive; } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public boolean isRecursive() { return recursive; } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public boolean isRecursive() { return recursive; } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public boolean isRecursive() { return recursive; } @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nullable String templateFileName); void setTemplatesLocation(String tem... | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public boolean isRecursive() { return recursive; } @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nullable String templateFileName); void setTemplatesLocation(String tem... |
@Test public void setRecursive() throws Exception { templateFilesResolver.setRecursive(false); Assert.assertFalse("recursive template file resolution should be off", templateFilesResolver.isRecursive()); } | public void setRecursive(boolean recursive) { this.recursive = recursive; } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public void setRecursive(boolean recursive) { this.recursive = recursive; } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public void setRecursive(boolean recursive) { this.recursive = recursive; } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public void setRecursive(boolean recursive) { this.recursive = recursive; } @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nullable String templateFileName); void setTem... | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public void setRecursive(boolean recursive) { this.recursive = recursive; } @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nullable String templateFileName); void setTem... |
@Test public void defaultTemplateLocation() throws Exception { Assert.assertNull("template file location should be null", new DefaultTemplateFilesResolver().getTemplatesLocation()); } | public String getTemplatesLocation() { return templatesLocation; } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public String getTemplatesLocation() { return templatesLocation; } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public String getTemplatesLocation() { return templatesLocation; } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public String getTemplatesLocation() { return templatesLocation; } @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nullable String templateFileName); void setTemplatesLoc... | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { public String getTemplatesLocation() { return templatesLocation; } @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nullable String templateFileName); void setTemplatesLoc... |
@Test public void resolveDebugOffRecursiveOn() throws Exception { final Collection<URL> urls = templateFilesResolver.resolve(); Assert.assertEquals("should resolve urls", 5, urls.size()); Set<String> names = nab_template_names(urls); for (final String s : new String[] {"template1", "template2", "template3", "sub/templa... | @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... |
@Test public void resolveWithFullTemplateNameDebugOff() throws Exception { final Optional<URL> url = templateFilesResolver.resolve("templates/template1"); Assert.assertTrue("should be present", url.isPresent()); Assert.assertTrue("template1Url file should end with template1.soy", url.get().getFile().endsWith("template1... | @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... |
@Test public void resolveWithTemplateNameDebugOff() throws Exception { final Optional<URL> url = templateFilesResolver.resolve("template1"); Assert.assertTrue("should be present", url.isPresent()); Assert.assertTrue("template1Url file should end with template1.soy", url.get().getFile().endsWith("template1.soy")); } | @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... |
@Test public void resolveWithFullTemplateNameExtDebugOff() throws Exception { final Optional<URL> url = templateFilesResolver.resolve("templates/template1.soy"); Assert.assertTrue("should be present", url.isPresent()); Assert.assertTrue("template1Url file should end with template1.soy", url.get().getFile().endsWith("te... | @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... |
@Test public void testDefaultWriteExpireUnit() throws Exception { Assert.assertEquals("default write expire unit should be", "DAYS", hashFileGenerator.getExpireAfterWriteUnit()); } | public String getExpireAfterWriteUnit() { return expireAfterWriteUnit; } | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public String getExpireAfterWriteUnit() { return expireAfterWriteUnit; } } | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public String getExpireAfterWriteUnit() { return expireAfterWriteUnit; } } | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public String getExpireAfterWriteUnit() { return expireAfterWriteUnit; } void afterPropertiesSet(); @Override Optional<String> hash(final Optional<URL> url); @Override Optional<String> hashMulti(final Collection<URL> urls); static String getMD5Check... | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public String getExpireAfterWriteUnit() { return expireAfterWriteUnit; } void afterPropertiesSet(); @Override Optional<String> hash(final Optional<URL> url); @Override Optional<String> hashMulti(final Collection<URL> urls); static String getMD5Check... |
@Test public void resolveWithTemplateNameExtDebugOff() throws Exception { final Optional<URL> url = templateFilesResolver.resolve("template1.soy"); Assert.assertTrue("should be present", url.isPresent()); Assert.assertTrue("template1Url file should end with template1.soy", url.get().getFile().endsWith("template1.soy"))... | @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... |
@Test public void resolveWithFullTemplateNameExtDebugOffShouldNotWork() throws Exception { final Optional<URL> url = templateFilesResolver.resolve("tmpl/template1.soy"); Assert.assertFalse("should be absent", url.isPresent()); } | @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... |
@Test public void cacheDisabledByDefault() throws Exception { templateFilesResolver.resolve("template1"); Assert.assertFalse("cache should not be empty", templateFilesResolver.cachedFiles.isEmpty()); } | @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... |
@Test public void cacheEnabledWithDebugOff() throws Exception { templateFilesResolver.resolve("template1"); Assert.assertFalse("cache should not be empty", templateFilesResolver.cachedFiles.isEmpty()); Assert.assertEquals("number of items in cache should be equal", 5, templateFilesResolver.cachedFiles.size()); } | @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } } | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... | ClasspathTemplateFilesResolver implements TemplateFilesResolver, InitializingBean { @Override public Collection<URL> resolve() throws IOException { Preconditions.checkNotNull(templatesLocation, "templatesLocation cannot be null!"); return Collections.unmodifiableCollection(handleResolution()); } @Override void afterPr... |
@Test public void defaultDebugFlag() throws Exception { Assert.assertFalse("debug flag should be off", defaultTemplateFilesResolver.isHotReloadMode()); } | public boolean isHotReloadMode() { return hotReloadMode; } | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public boolean isHotReloadMode() { return hotReloadMode; } } | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public boolean isHotReloadMode() { return hotReloadMode; } DefaultTemplateFilesResolver(); } | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public boolean isHotReloadMode() { return hotReloadMode; } DefaultTemplateFilesResolver(); @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nullable Stri... | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public boolean isHotReloadMode() { return hotReloadMode; } DefaultTemplateFilesResolver(); @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nullable Stri... |
@Test public void defaultRecursive() throws Exception { Assert.assertTrue("recursive template file resolution should be on", defaultTemplateFilesResolver.isRecursive()); } | public boolean isRecursive() { return recursive; } | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public boolean isRecursive() { return recursive; } } | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public boolean isRecursive() { return recursive; } DefaultTemplateFilesResolver(); } | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public boolean isRecursive() { return recursive; } DefaultTemplateFilesResolver(); @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nullable String templ... | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public boolean isRecursive() { return recursive; } DefaultTemplateFilesResolver(); @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nullable String templ... |
@Test public void setRecursive() throws Exception { defaultTemplateFilesResolver.setRecursive(false); Assert.assertFalse("recursive template file resolution should be off", defaultTemplateFilesResolver.isRecursive()); } | public void setRecursive(boolean recursive) { this.recursive = recursive; } | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public void setRecursive(boolean recursive) { this.recursive = recursive; } } | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public void setRecursive(boolean recursive) { this.recursive = recursive; } DefaultTemplateFilesResolver(); } | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public void setRecursive(boolean recursive) { this.recursive = recursive; } DefaultTemplateFilesResolver(); @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(fin... | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public void setRecursive(boolean recursive) { this.recursive = recursive; } DefaultTemplateFilesResolver(); @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(fin... |
@Test public void defaultTemplateLocation() throws Exception { Assert.assertNull("template file location should be null", defaultTemplateFilesResolver.getTemplatesLocation()); } | public Resource getTemplatesLocation() { return templatesLocation; } | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public Resource getTemplatesLocation() { return templatesLocation; } } | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public Resource getTemplatesLocation() { return templatesLocation; } DefaultTemplateFilesResolver(); } | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public Resource getTemplatesLocation() { return templatesLocation; } DefaultTemplateFilesResolver(); @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nul... | DefaultTemplateFilesResolver implements TemplateFilesResolver, ServletContextAware, InitializingBean { public Resource getTemplatesLocation() { return templatesLocation; } DefaultTemplateFilesResolver(); @Override void afterPropertiesSet(); @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final @Nul... |
@Test public void nonNull() throws Exception { Assert.assertNotNull("should not be null", emptyTemplateFilesResolver.resolve()); } | @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } | EmptyTemplateFilesResolver implements TemplateFilesResolver { @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } } | EmptyTemplateFilesResolver implements TemplateFilesResolver { @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } } | EmptyTemplateFilesResolver implements TemplateFilesResolver { @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final String templateName); } | EmptyTemplateFilesResolver implements TemplateFilesResolver { @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final String templateName); } |
@Test public void testResolveMany() throws Exception { Assert.assertTrue("should be empty", emptyTemplateFilesResolver.resolve().isEmpty()); } | @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } | EmptyTemplateFilesResolver implements TemplateFilesResolver { @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } } | EmptyTemplateFilesResolver implements TemplateFilesResolver { @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } } | EmptyTemplateFilesResolver implements TemplateFilesResolver { @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final String templateName); } | EmptyTemplateFilesResolver implements TemplateFilesResolver { @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final String templateName); } |
@Test public void testDefaultExpireTime() throws Exception { Assert.assertEquals("default expire in days is 1 day", 1, hashFileGenerator.getExpireAfterWrite()); } | public int getExpireAfterWrite() { return expireAfterWrite; } | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public int getExpireAfterWrite() { return expireAfterWrite; } } | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public int getExpireAfterWrite() { return expireAfterWrite; } } | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public int getExpireAfterWrite() { return expireAfterWrite; } void afterPropertiesSet(); @Override Optional<String> hash(final Optional<URL> url); @Override Optional<String> hashMulti(final Collection<URL> urls); static String getMD5Checksum(final I... | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public int getExpireAfterWrite() { return expireAfterWrite; } void afterPropertiesSet(); @Override Optional<String> hash(final Optional<URL> url); @Override Optional<String> hashMulti(final Collection<URL> urls); static String getMD5Checksum(final I... |
@Test public void testResolveOne() throws Exception { Assert.assertFalse("should be absent", emptyTemplateFilesResolver.resolve("template").isPresent()); } | @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } | EmptyTemplateFilesResolver implements TemplateFilesResolver { @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } } | EmptyTemplateFilesResolver implements TemplateFilesResolver { @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } } | EmptyTemplateFilesResolver implements TemplateFilesResolver { @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final String templateName); } | EmptyTemplateFilesResolver implements TemplateFilesResolver { @Override public Collection<URL> resolve() throws IOException { return Collections.emptyList(); } @Override Collection<URL> resolve(); @Override Optional<URL> resolve(final String templateName); } |
@Test public void defaultDebug() throws Exception { Assert.assertFalse("debug should be off", defaultSoyMsgBundleResolver.isHotReloadMode()); } | public boolean isHotReloadMode() { return hotReloadMode; } | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public boolean isHotReloadMode() { return hotReloadMode; } } | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public boolean isHotReloadMode() { return hotReloadMode; } } | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public boolean isHotReloadMode() { return hotReloadMode; } Optional<SoyMsgBundle> resolve(final Optional<Locale> locale); void setMessagesPath(final String messagesPath); void setHotReloadMode(final boolean hotReloadMode); void setFallbackToEnglish(boolean ... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public boolean isHotReloadMode() { return hotReloadMode; } Optional<SoyMsgBundle> resolve(final Optional<Locale> locale); void setMessagesPath(final String messagesPath); void setHotReloadMode(final boolean hotReloadMode); void setFallbackToEnglish(boolean ... |
@Test public void defaultMessagesPath() throws Exception { Assert.assertEquals("default messages path", "messages", defaultSoyMsgBundleResolver.getMessagesPath()); } | public String getMessagesPath() { return messagesPath; } | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public String getMessagesPath() { return messagesPath; } } | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public String getMessagesPath() { return messagesPath; } } | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public String getMessagesPath() { return messagesPath; } Optional<SoyMsgBundle> resolve(final Optional<Locale> locale); void setMessagesPath(final String messagesPath); void setHotReloadMode(final boolean hotReloadMode); void setFallbackToEnglish(boolean fa... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public String getMessagesPath() { return messagesPath; } Optional<SoyMsgBundle> resolve(final Optional<Locale> locale); void setMessagesPath(final String messagesPath); void setHotReloadMode(final boolean hotReloadMode); void setFallbackToEnglish(boolean fa... |
@Test public void defaultFallbackToEnglish() throws Exception { Assert.assertTrue("fallBack to English should be on", defaultSoyMsgBundleResolver.isFallbackToEnglish()); } | public boolean isFallbackToEnglish() { return fallbackToEnglish; } | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public boolean isFallbackToEnglish() { return fallbackToEnglish; } } | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public boolean isFallbackToEnglish() { return fallbackToEnglish; } } | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public boolean isFallbackToEnglish() { return fallbackToEnglish; } Optional<SoyMsgBundle> resolve(final Optional<Locale> locale); void setMessagesPath(final String messagesPath); void setHotReloadMode(final boolean hotReloadMode); void setFallbackToEnglish(... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public boolean isFallbackToEnglish() { return fallbackToEnglish; } Optional<SoyMsgBundle> resolve(final Optional<Locale> locale); void setMessagesPath(final String messagesPath); void setHotReloadMode(final boolean hotReloadMode); void setFallbackToEnglish(... |
@Test public void resolveWithNoLocale() throws Exception { Assert.assertFalse("value should be absent", defaultSoyMsgBundleResolver.resolve(Optional.<Locale>absent()).isPresent()); } | public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundles.get(locale.get()); } if (soyMsgBundle == null) { soyMsgBund... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundl... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundl... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundl... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundl... |
@Test public void resolveDefaultMessagePathValuePresent() throws Exception { final Optional<SoyMsgBundle> soyMsgBundleOptional = defaultSoyMsgBundleResolver.resolve(Optional.of(Locale.ENGLISH)); Assert.assertTrue("value should be present", soyMsgBundleOptional.isPresent()); } | public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundles.get(locale.get()); } if (soyMsgBundle == null) { soyMsgBund... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundl... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundl... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundl... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundl... |
@Test public void resolveDefaultMessagePathNotNull() throws Exception { final Optional<SoyMsgBundle> soyMsgBundleOptional = defaultSoyMsgBundleResolver.resolve(Optional.of(Locale.ENGLISH)); Assert.assertNotNull("value should be present", soyMsgBundleOptional.get()); } | public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundles.get(locale.get()); } if (soyMsgBundle == null) { soyMsgBund... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundl... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundl... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundl... | DefaultSoyMsgBundleResolver implements SoyMsgBundleResolver { public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { if (!locale.isPresent()) { return Optional.absent(); } synchronized (msgBundles) { SoyMsgBundle soyMsgBundle = null; if (isHotReloadModeOff()) { soyMsgBundle = msgBundl... |
@Test public void defaultNull() throws Exception { Assert.assertFalse(emptySoyMsgBundleResolver.resolve(null).isPresent()); } | @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } | EmptySoyMsgBundleResolver implements SoyMsgBundleResolver { @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } } | EmptySoyMsgBundleResolver implements SoyMsgBundleResolver { @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } } | EmptySoyMsgBundleResolver implements SoyMsgBundleResolver { @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } @Override Optional<SoyMsgBundle> resolve(final Optional<Locale> locale); } | EmptySoyMsgBundleResolver implements SoyMsgBundleResolver { @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } @Override Optional<SoyMsgBundle> resolve(final Optional<Locale> locale); } |
@Test public void defaultAbsent() throws Exception { Assert.assertFalse(emptySoyMsgBundleResolver.resolve(Optional.<Locale>absent()).isPresent()); } | @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } | EmptySoyMsgBundleResolver implements SoyMsgBundleResolver { @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } } | EmptySoyMsgBundleResolver implements SoyMsgBundleResolver { @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } } | EmptySoyMsgBundleResolver implements SoyMsgBundleResolver { @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } @Override Optional<SoyMsgBundle> resolve(final Optional<Locale> locale); } | EmptySoyMsgBundleResolver implements SoyMsgBundleResolver { @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } @Override Optional<SoyMsgBundle> resolve(final Optional<Locale> locale); } |
@Test public void localePassedIn() throws Exception { Assert.assertFalse(emptySoyMsgBundleResolver.resolve(Optional.of(Locale.GERMANY)).isPresent()); } | @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } | EmptySoyMsgBundleResolver implements SoyMsgBundleResolver { @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } } | EmptySoyMsgBundleResolver implements SoyMsgBundleResolver { @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } } | EmptySoyMsgBundleResolver implements SoyMsgBundleResolver { @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } @Override Optional<SoyMsgBundle> resolve(final Optional<Locale> locale); } | EmptySoyMsgBundleResolver implements SoyMsgBundleResolver { @Override public Optional<SoyMsgBundle> resolve(final Optional<Locale> locale) throws IOException { return Optional.absent(); } @Override Optional<SoyMsgBundle> resolve(final Optional<Locale> locale); } |
@Test public void testDefaultMaxEntries() throws Exception { Assert.assertEquals("default cache size is 10000", 10000, hashFileGenerator.getCacheMaxSize()); } | public int getCacheMaxSize() { return cacheMaxSize; } | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public int getCacheMaxSize() { return cacheMaxSize; } } | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public int getCacheMaxSize() { return cacheMaxSize; } } | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public int getCacheMaxSize() { return cacheMaxSize; } void afterPropertiesSet(); @Override Optional<String> hash(final Optional<URL> url); @Override Optional<String> hashMulti(final Collection<URL> urls); static String getMD5Checksum(final InputStre... | MD5HashFileGenerator implements HashFileGenerator, InitializingBean { public int getCacheMaxSize() { return cacheMaxSize; } void afterPropertiesSet(); @Override Optional<String> hash(final Optional<URL> url); @Override Optional<String> hashMulti(final Collection<URL> urls); static String getMD5Checksum(final InputStre... |
@Test public void shouldInternStringValues() { final String value = new String(new char[]{'a', 'b'}); assertThat(StringTestyValue.of(value).get(), is( sameInstance(StringTestyValue.of("ab").get()))); } | @Nonnull public final T get() { return value; } | Value implements Cloneable { @Nonnull public final T get() { return value; } } | Value implements Cloneable { @Nonnull public final T get() { return value; } protected Value(@Nonnull final T value); } | Value implements Cloneable { @Nonnull public final T get() { return value; } protected Value(@Nonnull final T value); @Nonnull abstract Class<T> type(); @Nonnull final T get(); @Nonnull final W map(
@Nonnull final Function<? super T, ? extends W> mapper); @SuppressWarnings({"CloneDoesntCallSuperClone", "un... | Value implements Cloneable { @Nonnull public final T get() { return value; } protected Value(@Nonnull final T value); @Nonnull abstract Class<T> type(); @Nonnull final T get(); @Nonnull final W map(
@Nonnull final Function<? super T, ? extends W> mapper); @SuppressWarnings({"CloneDoesntCallSuperClone", "un... |
@Test public void shouldReplaceEnvironmentVariables() { xprops.setProperty("bar", isWindows() ? "${USERNAME}" : "${USER}"); assertThat(xprops.getProperty("bar"), is(not(nullValue()))); } | @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... |
@Test public void shouldThrowOnMissingReplacement() { thrown.expect(MissingPropertyException.class); thrown.expectMessage(containsString("no-such-value")); xprops.setProperty("missing", "${no-such-value}"); xprops.getProperty("missing"); } | @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... |
@Test public void shouldThrowWhenWronglyKeyAssignedToNonString() { thrown.expect(ClassCastException.class); thrown.expectMessage(containsString(Integer.class.getName())); xprops.setProperty("bar", ""); final Integer ignored = xprops.getObject("bar"); } | @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... |
@Test public void shouldGetInt() { xprops.setProperty("bar", "3"); assertThat(xprops.getObject("int:bar"), is(equalTo(3))); } | @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... |
@Test public void shouldGetIntegerExplicit() { xprops.setProperty("bar", "3"); assertThat(xprops.getObject("java.math.BigInteger:bar"), is(equalTo(new BigInteger("3")))); } | @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... |
@Test public void shouldGetIntegerAliased() { xprops.setProperty("bar", "3"); assertThat(xprops.getObject("integer:bar"), is(equalTo(new BigInteger("3")))); } | @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... |
@Test public void shouldGetDecimal() { xprops.setProperty("bar", "3"); assertThat(xprops.getObject("decimal:bar"), is(equalTo(new BigDecimal("3")))); } | @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... |
@Test public void shouldGetResources() { xprops.setProperty("bar", format("classpath*:%sincluded*.properties", firstPathComponent(pathPrefix))); final List<Resource> resources = xprops.getObject("resource*:bar"); assertThat(resources.size(), is(equalTo(2))); assertThat(resources, tests( "contains resource filename endi... | @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... |
@Test public void shouldGetAddress() { xprops.setProperty("bar", "[2001:db8::1]:80"); final InetSocketAddress address = xprops.getObject("address:bar"); assertThat(address.getHostString(), is(equalTo("2001:db8::1"))); assertThat(address.getPort(), is(equalTo(80))); } | @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... |
@Test public void shouldThrowForBadAddress() { thrown.expect(FailedConversionException.class); thrown.expectMessage(containsString("address:bar")); thrown.expectMessage(containsString("-@-")); xprops.setProperty("bar", "-@-"); xprops.getObject("address:bar"); } | @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... | XProperties extends OrderedProperties { @Nullable public <T> T getObject(@Nonnull final String key) { return getObjectOrDefault(key, null); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties from(@Nonnull @NonNull final String absolutePath); void register(@Nonnull fin... |
@Test public void shouldNoticeRecursiveInclude() throws IOException { thrown.expect(RecursiveIncludeException.class); thrown.expectMessage(containsString(format("%s/tweedle-dee.properties", pathPrefix))); XProperties.from(format("%s/tweedle-dee.properties", pathPrefix)); } | @Nonnull public static XProperties from(@Nonnull @NonNull final String absolutePath) throws IOException { final Resource resource = new PathMatchingResourcePatternResolver() .getResource(absolutePath); try (final InputStream in = resource.getInputStream()) { final XProperties xprops = new XProperties(); xprops.included... | XProperties extends OrderedProperties { @Nonnull public static XProperties from(@Nonnull @NonNull final String absolutePath) throws IOException { final Resource resource = new PathMatchingResourcePatternResolver() .getResource(absolutePath); try (final InputStream in = resource.getInputStream()) { final XProperties xpr... | XProperties extends OrderedProperties { @Nonnull public static XProperties from(@Nonnull @NonNull final String absolutePath) throws IOException { final Resource resource = new PathMatchingResourcePatternResolver() .getResource(absolutePath); try (final InputStream in = resource.getInputStream()) { final XProperties xpr... | XProperties extends OrderedProperties { @Nonnull public static XProperties from(@Nonnull @NonNull final String absolutePath) throws IOException { final Resource resource = new PathMatchingResourcePatternResolver() .getResource(absolutePath); try (final InputStream in = resource.getInputStream()) { final XProperties xpr... | XProperties extends OrderedProperties { @Nonnull public static XProperties from(@Nonnull @NonNull final String absolutePath) throws IOException { final Resource resource = new PathMatchingResourcePatternResolver() .getResource(absolutePath); try (final InputStream in = resource.getInputStream()) { final XProperties xpr... |
@Test public void shouldIgnoreJavaClasses() { final Throwable x = new Throwable(); final StackTraceElement nonJava = new StackTraceElement("lotro.Bilbo", "smokes", "Bilbo.java", 5); x.setStackTrace(new StackTraceElement[]{ new StackTraceElement("java.lang.Frodo", "lives", "Frodo.java", 3), nonJava}); assertFramesRemain... | @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } } | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFocuser(@Nonnull final Predi... | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFocuser(@Nonnull final Predi... | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFocuser(@Nonnull final Predi... |
@Test public void shouldIgnoreJavaxClasses() { final Throwable x = new Throwable(); final StackTraceElement nonJavax = new StackTraceElement("lotro.Bilbo", "smokes", "Bilbo.java", 5); x.setStackTrace(new StackTraceElement[]{ new StackTraceElement("javax.lang.Frodo", "lives", "Frodo.java", 3), nonJavax}); assertFramesRe... | @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } } | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFocuser(@Nonnull final Predi... | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFocuser(@Nonnull final Predi... | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFocuser(@Nonnull final Predi... |
@Test public void shouldIgnoreSunClasses() { final Throwable x = new Throwable(); final StackTraceElement nonSun = new StackTraceElement("lotro.Bilbo", "smokes", "Bilbo.java", 5); x.setStackTrace(new StackTraceElement[]{ new StackTraceElement("sun.Frodo", "lives", "Frodo.java", 3), nonSun}); assertFramesRemaining(x, ig... | @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } } | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFocuser(@Nonnull final Predi... | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFocuser(@Nonnull final Predi... | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFocuser(@Nonnull final Predi... |
@Test public void shouldIgnoreComSunClasses() { final Throwable x = new Throwable(); final StackTraceElement nonComSun = new StackTraceElement("lotro.Bilbo", "smokes", "Bilbo.java", 5); x.setStackTrace(new StackTraceElement[]{ new StackTraceElement("com.sun.Frodo", "lives", "Frodo.java", 3), nonComSun}); assertFramesRe... | @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } } | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFocuser(@Nonnull final Predi... | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFocuser(@Nonnull final Predi... | StackTraceFocuser implements Function<E, E> { @Nonnull public static <E extends Throwable> StackTraceFocuser<E> ignoreJavaClasses() { return ignoreClassNames(defaultClassNameIgnores); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFocuser(@Nonnull final Predi... |
@Test public void shouldIgnoreWithCustomClassName() { final Throwable x = new Throwable(); final StackTraceElement nonWindfola = new StackTraceElement("lotro.Bilbo", "smokes", "Bilbo.java", 5); x.setStackTrace(new StackTraceElement[]{ new StackTraceElement("windfola.Frodo", "lives", "Frodo.java", 3), nonWindfola}); ass... | @Nonnull public static Predicate<StackTraceElement> ignoreClassName(@Nonnull final Pattern className) { return frame -> className.matcher(frame.getClassName()).find(); } | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreClassName(@Nonnull final Pattern className) { return frame -> className.matcher(frame.getClassName()).find(); } } | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreClassName(@Nonnull final Pattern className) { return frame -> className.matcher(frame.getClassName()).find(); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTra... | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreClassName(@Nonnull final Pattern className) { return frame -> className.matcher(frame.getClassName()).find(); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTra... | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreClassName(@Nonnull final Pattern className) { return frame -> className.matcher(frame.getClassName()).find(); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTra... |
@Test public void shouldIgnoreWithCustomMethodName() { final Throwable x = new Throwable(); final StackTraceElement nonLives = new StackTraceElement("lotro.Bilbo", "smokes", "Bilbo.java", 5); x.setStackTrace(new StackTraceElement[]{ new StackTraceElement("windfola.Frodo", "lives", "Frodo.java", 3), nonLives}); assertFr... | @Nonnull public static Predicate<StackTraceElement> ignoreMethodName(@Nonnull final Pattern methodName) { return frame -> methodName.matcher(frame.getMethodName()).find(); } | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreMethodName(@Nonnull final Pattern methodName) { return frame -> methodName.matcher(frame.getMethodName()).find(); } } | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreMethodName(@Nonnull final Pattern methodName) { return frame -> methodName.matcher(frame.getMethodName()).find(); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs Stac... | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreMethodName(@Nonnull final Pattern methodName) { return frame -> methodName.matcher(frame.getMethodName()).find(); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs Stac... | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreMethodName(@Nonnull final Pattern methodName) { return frame -> methodName.matcher(frame.getMethodName()).find(); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs Stac... |
@Test public void shouldIgnoreWithCustomFileName() { final Throwable x = new Throwable(); final StackTraceElement nonFrodo = new StackTraceElement("lotro.Bilbo", "smokes", "Bilbo.java", 5); x.setStackTrace(new StackTraceElement[]{ new StackTraceElement("windfola.Frodo", "lives", "Frodo.java", 3), nonFrodo}); assertFram... | @Nonnull public static Predicate<StackTraceElement> ignoreFileName(@Nonnull final Pattern fileName) { return frame -> fileName.matcher(frame.getFileName()).find(); } | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreFileName(@Nonnull final Pattern fileName) { return frame -> fileName.matcher(frame.getFileName()).find(); } } | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreFileName(@Nonnull final Pattern fileName) { return frame -> fileName.matcher(frame.getFileName()).find(); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFo... | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreFileName(@Nonnull final Pattern fileName) { return frame -> fileName.matcher(frame.getFileName()).find(); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFo... | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreFileName(@Nonnull final Pattern fileName) { return frame -> fileName.matcher(frame.getFileName()).find(); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @SafeVarargs StackTraceFo... |
@Test public void shouldIgnoreWithCustomLineNumber() { final Throwable x = new Throwable(); final StackTraceElement nonThree = new StackTraceElement("lotro.Bilbo", "smokes", "Bilbo.java", 5); x.setStackTrace(new StackTraceElement[]{ new StackTraceElement("windfola.Frodo", "lives", "Frodo.java", 3), nonThree}); assertFr... | @Nonnull public static Predicate<StackTraceElement> ignoreLineNumber(@Nonnull final Pattern lineNumber) { return frame -> lineNumber.matcher(String.valueOf(frame.getLineNumber())).find(); } | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreLineNumber(@Nonnull final Pattern lineNumber) { return frame -> lineNumber.matcher(String.valueOf(frame.getLineNumber())).find(); } } | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreLineNumber(@Nonnull final Pattern lineNumber) { return frame -> lineNumber.matcher(String.valueOf(frame.getLineNumber())).find(); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @S... | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreLineNumber(@Nonnull final Pattern lineNumber) { return frame -> lineNumber.matcher(String.valueOf(frame.getLineNumber())).find(); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @S... | StackTraceFocuser implements Function<E, E> { @Nonnull public static Predicate<StackTraceElement> ignoreLineNumber(@Nonnull final Pattern lineNumber) { return frame -> lineNumber.matcher(String.valueOf(frame.getLineNumber())).find(); } StackTraceFocuser(@Nonnull final Iterable<Predicate<StackTraceElement>> ignores); @S... |
@Test public void shouldHaveNone() { assertThat(over(Objects::isNull, identity()), is(emptyIterable())); } | @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } | LinkedIterable implements Iterable<T> { @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } } | LinkedIterable implements Iterable<T> { @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } private LinkedIterable(final T head, final Predicate<T> terminate,
... | LinkedIterable implements Iterable<T> { @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } private LinkedIterable(final T head, final Predicate<T> terminate,
... | LinkedIterable implements Iterable<T> { @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } private LinkedIterable(final T head, final Predicate<T> terminate,
... |
@Test public void shouldHaveOne() { assertThat(over(this, Objects::isNull, t -> null), is(contains(this))); } | @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } | LinkedIterable implements Iterable<T> { @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } } | LinkedIterable implements Iterable<T> { @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } private LinkedIterable(final T head, final Predicate<T> terminate,
... | LinkedIterable implements Iterable<T> { @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } private LinkedIterable(final T head, final Predicate<T> terminate,
... | LinkedIterable implements Iterable<T> { @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } private LinkedIterable(final T head, final Predicate<T> terminate,
... |
@Test public void shouldThrowOnBadInclude() throws IOException { thrown.expect(FileNotFoundException.class); thrown.expectMessage(containsString("no-such-location")); xprops.load(new StringReader("#include no-such-location")); } | @Override public synchronized void load(@Nonnull final Reader reader) throws IOException { final ResourcePatternResolver loader = new PathMatchingResourcePatternResolver(); try (final CharArrayWriter writer = new CharArrayWriter()) { try (final BufferedReader lines = new BufferedReader(reader)) { for (String line = lin... | XProperties extends OrderedProperties { @Override public synchronized void load(@Nonnull final Reader reader) throws IOException { final ResourcePatternResolver loader = new PathMatchingResourcePatternResolver(); try (final CharArrayWriter writer = new CharArrayWriter()) { try (final BufferedReader lines = new Buffered... | XProperties extends OrderedProperties { @Override public synchronized void load(@Nonnull final Reader reader) throws IOException { final ResourcePatternResolver loader = new PathMatchingResourcePatternResolver(); try (final CharArrayWriter writer = new CharArrayWriter()) { try (final BufferedReader lines = new Buffered... | XProperties extends OrderedProperties { @Override public synchronized void load(@Nonnull final Reader reader) throws IOException { final ResourcePatternResolver loader = new PathMatchingResourcePatternResolver(); try (final CharArrayWriter writer = new CharArrayWriter()) { try (final BufferedReader lines = new Buffered... | XProperties extends OrderedProperties { @Override public synchronized void load(@Nonnull final Reader reader) throws IOException { final ResourcePatternResolver loader = new PathMatchingResourcePatternResolver(); try (final CharArrayWriter writer = new CharArrayWriter()) { try (final BufferedReader lines = new Buffered... |
@Test public void shouldHaveMany() { final Predicate<Integer> terminate = t -> 3 == t; final Function<Integer, Integer> traverse = t -> t + 1; assertThat(over(0, terminate, traverse), contains(0, 1, 2)); } | @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } | LinkedIterable implements Iterable<T> { @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } } | LinkedIterable implements Iterable<T> { @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } private LinkedIterable(final T head, final Predicate<T> terminate,
... | LinkedIterable implements Iterable<T> { @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } private LinkedIterable(final T head, final Predicate<T> terminate,
... | LinkedIterable implements Iterable<T> { @Nonnull public static <T> Iterable<T> over(@Nullable final T head, @Nonnull final Predicate<T> terminate, @Nonnull final Function<T, T> traverse) { return new LinkedIterable<>(head, terminate, traverse); } private LinkedIterable(final T head, final Predicate<T> terminate,
... |
@Test public void shouldConvertString() throws Exception { assertThat("bob", is(equalTo(converter.convert(String.class, "bob")))); } | @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... |
@Test public void shouldConvertRegistered() throws Exception { assertThat(Paths.get("/dev/null"), is(equalTo(converter.convert(Path.class, "/dev/null")))); } | @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... |
@Test public void shouldConvertWithValueOf() throws Exception { assertThat(3, is(equalTo(converter.convert(Integer.class, "3")))); } | @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... |
@Test public void shouldConvertWithOf() throws Exception { assertThat(UTC, is(equalTo(converter.convert(ZoneOffset.class, "Z")))); } | @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... |
@Test public void shouldConvertWithNew() throws Exception { assertThat(new File("/dev/null"), is(equalTo(converter.convert(File.class, "/dev/null")))); } | @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... |
@Test public void shouldConvertToResourceList() throws Exception { final String path = format("classpath:/%s.class", getClass().getName().replace('.', '/')); final List<Resource> resources = asList( new PathMatchingResourcePatternResolver().getResources(path)); assertThat(resources, is(equalTo(converter.convert(new Typ... | @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... |
@Test(expected = UnsupportedConversion.class) public void shouldThrowWhenUnsupported() throws Exception { converter.convert(Package.class, getClass().getPackage().getName()); } | @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } } | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... | Converter { @Nonnull public <T> T convert(@Nonnull final Class<T> type, @Nonnull final String value) throws Exception { return convert(TypeToken.of(wrap(type)), value); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
@N... |
@Test(expected = DuplicateConversion.class) public void shouldThrowWhenDuplicate() { converter.register(Path.class, Paths::get); } | public <T> void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory) throws DuplicateConversion { register(TypeToken.of(type), factory); } | Converter { public <T> void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory) throws DuplicateConversion { register(TypeToken.of(type), factory); } } | Converter { public <T> void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory) throws DuplicateConversion { register(TypeToken.of(type), factory); } } | Converter { public <T> void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory) throws DuplicateConversion { register(TypeToken.of(type), factory); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
... | Converter { public <T> void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory) throws DuplicateConversion { register(TypeToken.of(type), factory); } void register(@Nonnull final Class<T> type, @Nonnull final Conversion<T, ?> factory); void register(@Nonnull final TypeToken<T> type,
... |
@Test public void shouldReplaceGetProperty() { xprops.setProperty("foo", "found"); xprops.setProperty("bar", "${foo}"); assertThat(xprops.getProperty("bar"), is(equalTo("found"))); } | @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... |
@Test public void shouldReplaceGetPropertyFromSystemProperties() { try { System.setProperty("foo", "found"); xprops.setProperty("bar", "${foo}"); assertThat(xprops.getProperty("bar"), is(equalTo("found"))); } finally { System.clearProperty("foo"); } } | @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... |
@Test public void shouldReplaceGetPropertyFromEnvironment() { new MockUp<System>() { @Mock(invocations = 1) public String getenv(final String key) { return "found"; } }; xprops.setProperty("bar", "${foo}"); assertThat(xprops.getProperty("bar"), is(equalTo("found"))); } | @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... |
@Test public void shouldReplaceRepeatedGetProperty() { xprops.setProperty("baz", "found"); xprops.setProperty("foo", "${baz}"); xprops.setProperty("bar", "${foo}"); assertThat(xprops.getProperty("bar"), is(equalTo("found"))); } | @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... |
@Test public void shouldReplaceNestedGetProperty() { xprops.setProperty("baz", "found"); xprops.setProperty("foo", "baz"); xprops.setProperty("bar", "${${foo}}"); assertThat(xprops.getProperty("bar"), is(equalTo("found"))); } | @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... |
@Test public void shouldReplaceGet() { xprops.setProperty("foo", "found"); xprops.setProperty("bar", "${foo}"); assertThat(xprops.get("bar"), is(equalTo((Object) "found"))); } | @Nullable @Override public synchronized Object get(final Object key) { final Object value = super.get(key); if (null == value || !(value instanceof String)) return value; return substitutor.replace((String) value); } | XProperties extends OrderedProperties { @Nullable @Override public synchronized Object get(final Object key) { final Object value = super.get(key); if (null == value || !(value instanceof String)) return value; return substitutor.replace((String) value); } } | XProperties extends OrderedProperties { @Nullable @Override public synchronized Object get(final Object key) { final Object value = super.get(key); if (null == value || !(value instanceof String)) return value; return substitutor.replace((String) value); } XProperties(); XProperties(@Nonnull final Map<String, String> ... | XProperties extends OrderedProperties { @Nullable @Override public synchronized Object get(final Object key) { final Object value = super.get(key); if (null == value || !(value instanceof String)) return value; return substitutor.replace((String) value); } XProperties(); XProperties(@Nonnull final Map<String, String> ... | XProperties extends OrderedProperties { @Nullable @Override public synchronized Object get(final Object key) { final Object value = super.get(key); if (null == value || !(value instanceof String)) return value; return substitutor.replace((String) value); } XProperties(); XProperties(@Nonnull final Map<String, String> ... |
@Test public void shouldReplaceSystemProperty() { xprops.setProperty("bar", "${user.name}"); assertThat(xprops.getProperty("bar"), is(not(nullValue()))); } | @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); } | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... | XProperties extends OrderedProperties { @Nullable @Override public String getProperty(final String key) { final String value = super.getProperty(key); if (null == value) return null; return substitutor.replace(value); } XProperties(); XProperties(@Nonnull final Map<String, String> initial); @Nonnull static XProperties... |
@Test void braessTestFixed() { List<Path> shortPath = null; try { shortPath = SPAlgorithms.kShortestPaths(graph, A, D,3); } catch (Exception e) { fail(e); } Path abd = new Path(); abd.add(AB); abd.add(BD); Path acd = new Path(); acd.add(AC); acd.add(CD); Path abcd = new Path(); abcd.add(AB); abcd.add(BC); abcd.add(CD);... | public static List<Path> kShortestPaths(Graph g, Node origin, Node destination, Integer K) throws Exception{ List<Path> A = new LinkedList<Path>(); PriorityQueue<Path> B = new PriorityQueue<Path>(); A.add(SPAlgorithms.dijkstra(g, origin,destination)); if (A.get(0) == null) throw new Exception(); for (Integer k = 1; k <... | SPAlgorithms { public static List<Path> kShortestPaths(Graph g, Node origin, Node destination, Integer K) throws Exception{ List<Path> A = new LinkedList<Path>(); PriorityQueue<Path> B = new PriorityQueue<Path>(); A.add(SPAlgorithms.dijkstra(g, origin,destination)); if (A.get(0) == null) throw new Exception(); for (Int... | SPAlgorithms { public static List<Path> kShortestPaths(Graph g, Node origin, Node destination, Integer K) throws Exception{ List<Path> A = new LinkedList<Path>(); PriorityQueue<Path> B = new PriorityQueue<Path>(); A.add(SPAlgorithms.dijkstra(g, origin,destination)); if (A.get(0) == null) throw new Exception(); for (Int... | SPAlgorithms { public static List<Path> kShortestPaths(Graph g, Node origin, Node destination, Integer K) throws Exception{ List<Path> A = new LinkedList<Path>(); PriorityQueue<Path> B = new PriorityQueue<Path>(); A.add(SPAlgorithms.dijkstra(g, origin,destination)); if (A.get(0) == null) throw new Exception(); for (Int... | SPAlgorithms { public static List<Path> kShortestPaths(Graph g, Node origin, Node destination, Integer K) throws Exception{ List<Path> A = new LinkedList<Path>(); PriorityQueue<Path> B = new PriorityQueue<Path>(); A.add(SPAlgorithms.dijkstra(g, origin,destination)); if (A.get(0) == null) throw new Exception(); for (Int... |
@Test public void testGetExtraTitleReturnsNullIfMissing() { Intent testIntent = new Intent(); doReturn(testIntent).when(activity).getIntent(); String title = activity.getExtraTitle(); assertNull(title); } | String getExtraTitle() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_TITLE); } return null; } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraTitle() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_TITLE); } return null; } } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraTitle() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_TITLE); } return null; } } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraTitle() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_TITLE); } return null; } } | Gateway3DSecureActivity extends AppCompatActivity { String getExtraTitle() { Bundle extras = getIntent().getExtras(); if (extras != null) { return extras.getString(EXTRA_TITLE); } return null; } static final String EXTRA_HTML; static final String EXTRA_TITLE; static final String EXTRA_ACS_RESULT; } |
@Test public void testJsonConstructorWithMap() { String json = "{\n" + " \"k1\":\"v1\",\n" + " \"k2\":{\n" + " \"k21\": \"v21\",\n" + " \"k22\": \"v22\",\n" + " \"k23\" : {\n" + " \"k231\": \"v231\"\n" + " }\n" + " }\n" + " }"; GatewayMap map = new GatewayMap(json); assertEquals(map.get("k1"), "v1"); assert map.get("k2... | @Override public Object get(Object keyPath) { String[] keys = ((String) keyPath).split("\\."); if (keys.length <= 1) { Matcher m = arrayIndexPattern.matcher(keys[0]); if (!m.matches()) { return super.get(keys[0]); } else { String key = m.group(1); Object o = super.get(key); if (!(o instanceof List)) { throw new Illegal... | GatewayMap extends LinkedHashMap<String, Object> { @Override public Object get(Object keyPath) { String[] keys = ((String) keyPath).split("\\."); if (keys.length <= 1) { Matcher m = arrayIndexPattern.matcher(keys[0]); if (!m.matches()) { return super.get(keys[0]); } else { String key = m.group(1); Object o = super.get(... | GatewayMap extends LinkedHashMap<String, Object> { @Override public Object get(Object keyPath) { String[] keys = ((String) keyPath).split("\\."); if (keys.length <= 1) { Matcher m = arrayIndexPattern.matcher(keys[0]); if (!m.matches()) { return super.get(keys[0]); } else { String key = m.group(1); Object o = super.get(... | GatewayMap extends LinkedHashMap<String, Object> { @Override public Object get(Object keyPath) { String[] keys = ((String) keyPath).split("\\."); if (keys.length <= 1) { Matcher m = arrayIndexPattern.matcher(keys[0]); if (!m.matches()) { return super.get(keys[0]); } else { String key = m.group(1); Object o = super.get(... | GatewayMap extends LinkedHashMap<String, Object> { @Override public Object get(Object keyPath) { String[] keys = ((String) keyPath).split("\\."); if (keys.length <= 1) { Matcher m = arrayIndexPattern.matcher(keys[0]); if (!m.matches()) { return super.get(keys[0]); } else { String key = m.group(1); Object o = super.get(... |
@Test public void keyValueConstructorAddsKey() { assertEquals(new GatewayMap("k1", "v1").get("k1"), "v1"); assertEquals(new GatewayMap("k1.k2", "v12").get("k1.k2"), "v12"); } | @Override public Object get(Object keyPath) { String[] keys = ((String) keyPath).split("\\."); if (keys.length <= 1) { Matcher m = arrayIndexPattern.matcher(keys[0]); if (!m.matches()) { return super.get(keys[0]); } else { String key = m.group(1); Object o = super.get(key); if (!(o instanceof List)) { throw new Illegal... | GatewayMap extends LinkedHashMap<String, Object> { @Override public Object get(Object keyPath) { String[] keys = ((String) keyPath).split("\\."); if (keys.length <= 1) { Matcher m = arrayIndexPattern.matcher(keys[0]); if (!m.matches()) { return super.get(keys[0]); } else { String key = m.group(1); Object o = super.get(... | GatewayMap extends LinkedHashMap<String, Object> { @Override public Object get(Object keyPath) { String[] keys = ((String) keyPath).split("\\."); if (keys.length <= 1) { Matcher m = arrayIndexPattern.matcher(keys[0]); if (!m.matches()) { return super.get(keys[0]); } else { String key = m.group(1); Object o = super.get(... | GatewayMap extends LinkedHashMap<String, Object> { @Override public Object get(Object keyPath) { String[] keys = ((String) keyPath).split("\\."); if (keys.length <= 1) { Matcher m = arrayIndexPattern.matcher(keys[0]); if (!m.matches()) { return super.get(keys[0]); } else { String key = m.group(1); Object o = super.get(... | GatewayMap extends LinkedHashMap<String, Object> { @Override public Object get(Object keyPath) { String[] keys = ((String) keyPath).split("\\."); if (keys.length <= 1) { Matcher m = arrayIndexPattern.matcher(keys[0]); if (!m.matches()) { return super.get(keys[0]); } else { String key = m.group(1); Object o = super.get(... |
@Test public void testSetMerchantIdThrowsExceptionIfNull() throws Exception { try { gateway.setMerchantId(null); fail("Null merchant ID should throw illegal argument exception"); } catch (Exception e) { assertTrue(e instanceof IllegalArgumentException); } } | public Gateway setMerchantId(String merchantId) { if (merchantId == null) { throw new IllegalArgumentException("Merchant ID may not be null"); } this.merchantId = merchantId; return this; } | Gateway { public Gateway setMerchantId(String merchantId) { if (merchantId == null) { throw new IllegalArgumentException("Merchant ID may not be null"); } this.merchantId = merchantId; return this; } } | Gateway { public Gateway setMerchantId(String merchantId) { if (merchantId == null) { throw new IllegalArgumentException("Merchant ID may not be null"); } this.merchantId = merchantId; return this; } Gateway(); } | Gateway { public Gateway setMerchantId(String merchantId) { if (merchantId == null) { throw new IllegalArgumentException("Merchant ID may not be null"); } this.merchantId = merchantId; return this; } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Regio... | Gateway { public Gateway setMerchantId(String merchantId) { if (merchantId == null) { throw new IllegalArgumentException("Merchant ID may not be null"); } this.merchantId = merchantId; return this; } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Regio... |
@Test public void setMerchantIdWorksAsExpected() throws Exception { gateway.setMerchantId("MERCHANT_ID"); assertEquals(gateway.merchantId, "MERCHANT_ID"); } | public Gateway setMerchantId(String merchantId) { if (merchantId == null) { throw new IllegalArgumentException("Merchant ID may not be null"); } this.merchantId = merchantId; return this; } | Gateway { public Gateway setMerchantId(String merchantId) { if (merchantId == null) { throw new IllegalArgumentException("Merchant ID may not be null"); } this.merchantId = merchantId; return this; } } | Gateway { public Gateway setMerchantId(String merchantId) { if (merchantId == null) { throw new IllegalArgumentException("Merchant ID may not be null"); } this.merchantId = merchantId; return this; } Gateway(); } | Gateway { public Gateway setMerchantId(String merchantId) { if (merchantId == null) { throw new IllegalArgumentException("Merchant ID may not be null"); } this.merchantId = merchantId; return this; } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Regio... | Gateway { public Gateway setMerchantId(String merchantId) { if (merchantId == null) { throw new IllegalArgumentException("Merchant ID may not be null"); } this.merchantId = merchantId; return this; } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Regio... |
@Test public void testSetRegionThrowsExceptionIfNull() throws Exception { try { gateway.setRegion(null); fail("Null region should throw illegal argument exception"); } catch (Exception e) { assertTrue(e instanceof IllegalArgumentException); } } | public Gateway setRegion(Region region) { if (region == null) { throw new IllegalArgumentException("Region may not be null"); } this.region = region; return this; } | Gateway { public Gateway setRegion(Region region) { if (region == null) { throw new IllegalArgumentException("Region may not be null"); } this.region = region; return this; } } | Gateway { public Gateway setRegion(Region region) { if (region == null) { throw new IllegalArgumentException("Region may not be null"); } this.region = region; return this; } Gateway(); } | Gateway { public Gateway setRegion(Region region) { if (region == null) { throw new IllegalArgumentException("Region may not be null"); } this.region = region; return this; } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSes... | Gateway { public Gateway setRegion(Region region) { if (region == null) { throw new IllegalArgumentException("Region may not be null"); } this.region = region; return this; } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSes... |
@Test public void testSetRegionWorksAsIntended() throws Exception { gateway.setRegion(Gateway.Region.ASIA_PACIFIC); assertEquals(Gateway.Region.ASIA_PACIFIC, gateway.region); } | public Gateway setRegion(Region region) { if (region == null) { throw new IllegalArgumentException("Region may not be null"); } this.region = region; return this; } | Gateway { public Gateway setRegion(Region region) { if (region == null) { throw new IllegalArgumentException("Region may not be null"); } this.region = region; return this; } } | Gateway { public Gateway setRegion(Region region) { if (region == null) { throw new IllegalArgumentException("Region may not be null"); } this.region = region; return this; } Gateway(); } | Gateway { public Gateway setRegion(Region region) { if (region == null) { throw new IllegalArgumentException("Region may not be null"); } this.region = region; return this; } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSes... | Gateway { public Gateway setRegion(Region region) { if (region == null) { throw new IllegalArgumentException("Region may not be null"); } this.region = region; return this; } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSes... |
@Test public void testStart3DSecureActivitySkipsTitleIfNull() { Activity activity = mock(Activity.class); Intent intent = new Intent(); String testHtml = "html"; Gateway.start3DSecureActivity(activity, testHtml, null, intent); verify(activity).startActivityForResult(intent, Gateway.REQUEST_3D_SECURE); assertTrue(intent... | public static void start3DSecureActivity(Activity activity, String html) { start3DSecureActivity(activity, html, null); } | Gateway { public static void start3DSecureActivity(Activity activity, String html) { start3DSecureActivity(activity, html, null); } } | Gateway { public static void start3DSecureActivity(Activity activity, String html) { start3DSecureActivity(activity, html, null); } Gateway(); } | Gateway { public static void start3DSecureActivity(Activity activity, String html) { start3DSecureActivity(activity, html, null); } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSession(String sessionId, String apiVersion, G... | Gateway { public static void start3DSecureActivity(Activity activity, String html) { start3DSecureActivity(activity, html, null); } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSession(String sessionId, String apiVersion, G... |
@Test public void testStart3DSecureActivityWorksAsExpected() { Activity activity = mock(Activity.class); Intent intent = new Intent(); String testHtml = "html"; String testTitle = "title"; Gateway.start3DSecureActivity(activity, testHtml, testTitle, intent); verify(activity).startActivityForResult(intent, Gateway.REQUE... | public static void start3DSecureActivity(Activity activity, String html) { start3DSecureActivity(activity, html, null); } | Gateway { public static void start3DSecureActivity(Activity activity, String html) { start3DSecureActivity(activity, html, null); } } | Gateway { public static void start3DSecureActivity(Activity activity, String html) { start3DSecureActivity(activity, html, null); } Gateway(); } | Gateway { public static void start3DSecureActivity(Activity activity, String html) { start3DSecureActivity(activity, html, null); } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSession(String sessionId, String apiVersion, G... | Gateway { public static void start3DSecureActivity(Activity activity, String html) { start3DSecureActivity(activity, html, null); } Gateway(); String getMerchantId(); Gateway setMerchantId(String merchantId); Region getRegion(); Gateway setRegion(Region region); void updateSession(String sessionId, String apiVersion, G... |
@Test public void testHandle3DSecureResultReturnsFalseWithNullCallback() { assertFalse(Gateway.handle3DSecureResult(0, 0, null, null)); } | public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivity.EXTRA_AC... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... |
@Test public void testHandle3DSSecureResultReturnsFalseIfInvalidRequestCode() { int invalidRequestCode = 10; Gateway3DSecureCallback callback = mock(Gateway3DSecureCallback.class); assertFalse(Gateway.handle3DSecureResult(invalidRequestCode, 0, null, callback)); } | public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivity.EXTRA_AC... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... | Gateway { public static boolean handle3DSecureResult(int requestCode, int resultCode, Intent data, Gateway3DSecureCallback callback) { if (callback == null) { return false; } if (requestCode == REQUEST_3D_SECURE) { if (resultCode == Activity.RESULT_OK) { String acsResultJson = data.getStringExtra(Gateway3DSecureActivit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.