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 normalizeResourcePathSlash02() { assertEquals("Normalized", "/", Path.normalizeResourcePath(" /")); }
public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
@Test public void normalizeResourcePathSlash03() { assertEquals("Normalized", "/", Path.normalizeResourcePath(" / ")); }
public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
@Test public void normalizeResourcePathSlash04() { assertEquals("Normalized", "/", Path.normalizeResourcePath("/ ")); }
public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
@SuppressWarnings("deprecation") @Test public void testParseWebXml() throws Exception { WebAppParser parser = new WebAppParser(null); File file = new File("src/test/resources/web.xml"); assertTrue(file.exists()); WebAppType parseWebXml = parser.parseWebXml(file.toURL()); assertNotNull(parseWebXml); List<JAXBElement<?>>...
protected WebAppType parseWebXml(URL url) { try { XMLReader reader = XMLReaderFactory.createXMLReader(); NamespaceFilter inFilter = new NamespaceFilter("http: inFilter.setParent(reader); JAXBContext context = JAXBContext.newInstance(WebAppType.class); Unmarshaller unmarshaller = context.createUnmarshaller(); SAXSource ...
WebAppParser { protected WebAppType parseWebXml(URL url) { try { XMLReader reader = XMLReaderFactory.createXMLReader(); NamespaceFilter inFilter = new NamespaceFilter("http: inFilter.setParent(reader); JAXBContext context = JAXBContext.newInstance(WebAppType.class); Unmarshaller unmarshaller = context.createUnmarshalle...
WebAppParser { protected WebAppType parseWebXml(URL url) { try { XMLReader reader = XMLReaderFactory.createXMLReader(); NamespaceFilter inFilter = new NamespaceFilter("http: inFilter.setParent(reader); JAXBContext context = JAXBContext.newInstance(WebAppType.class); Unmarshaller unmarshaller = context.createUnmarshalle...
WebAppParser { protected WebAppType parseWebXml(URL url) { try { XMLReader reader = XMLReaderFactory.createXMLReader(); NamespaceFilter inFilter = new NamespaceFilter("http: inFilter.setParent(reader); JAXBContext context = JAXBContext.newInstance(WebAppType.class); Unmarshaller unmarshaller = context.createUnmarshalle...
WebAppParser { protected WebAppType parseWebXml(URL url) { try { XMLReader reader = XMLReaderFactory.createXMLReader(); NamespaceFilter inFilter = new NamespaceFilter("http: inFilter.setParent(reader); JAXBContext context = JAXBContext.newInstance(WebAppType.class); Unmarshaller unmarshaller = context.createUnmarshalle...
@Test public void testExtractNameVersionType() { String[] nameVersion; nameVersion = DeployerUtils.extractNameVersionType("test-1.0.0.war"); assertEquals("test", nameVersion[0]); assertEquals("1.0.0", nameVersion[1]); nameVersion = DeployerUtils.extractNameVersionType("test.war"); assertEquals("test", nameVersion[0]); ...
public static String[] extractNameVersionType(String url) { Matcher m = ARTIFACT_MATCHER.matcher(url); if (!m.matches()) { return new String[]{url.split("\\.")[0], DEFAULT_VERSION}; } else { StringBuilder v = new StringBuilder(); String d1 = m.group(1); String d2 = m.group(2); String d3 = m.group(3); String d4 = m.grou...
DeployerUtils { public static String[] extractNameVersionType(String url) { Matcher m = ARTIFACT_MATCHER.matcher(url); if (!m.matches()) { return new String[]{url.split("\\.")[0], DEFAULT_VERSION}; } else { StringBuilder v = new StringBuilder(); String d1 = m.group(1); String d2 = m.group(2); String d3 = m.group(3); St...
DeployerUtils { public static String[] extractNameVersionType(String url) { Matcher m = ARTIFACT_MATCHER.matcher(url); if (!m.matches()) { return new String[]{url.split("\\.")[0], DEFAULT_VERSION}; } else { StringBuilder v = new StringBuilder(); String d1 = m.group(1); String d2 = m.group(2); String d3 = m.group(3); St...
DeployerUtils { public static String[] extractNameVersionType(String url) { Matcher m = ARTIFACT_MATCHER.matcher(url); if (!m.matches()) { return new String[]{url.split("\\.")[0], DEFAULT_VERSION}; } else { StringBuilder v = new StringBuilder(); String d1 = m.group(1); String d2 = m.group(2); String d3 = m.group(3); St...
DeployerUtils { public static String[] extractNameVersionType(String url) { Matcher m = ARTIFACT_MATCHER.matcher(url); if (!m.matches()) { return new String[]{url.split("\\.")[0], DEFAULT_VERSION}; } else { StringBuilder v = new StringBuilder(); String d1 = m.group(1); String d2 = m.group(2); String d3 = m.group(3); St...
@Test public void checkGetServiceFlow() { replay(bundle, serviceRegistration, httpService); Object result = underTest.getService(bundle, serviceRegistration); assertNotNull("expect not null", result); verify(bundle, serviceRegistration, httpService); }
@Override public HttpService getService(final Bundle bundle, final ServiceRegistration<HttpService> serviceRegistration) { LOG.info("Binding bundle: [" + bundle + "] to http service"); return createService(bundle); }
HttpServiceFactoryImpl implements ServiceFactory<HttpService> { @Override public HttpService getService(final Bundle bundle, final ServiceRegistration<HttpService> serviceRegistration) { LOG.info("Binding bundle: [" + bundle + "] to http service"); return createService(bundle); } }
HttpServiceFactoryImpl implements ServiceFactory<HttpService> { @Override public HttpService getService(final Bundle bundle, final ServiceRegistration<HttpService> serviceRegistration) { LOG.info("Binding bundle: [" + bundle + "] to http service"); return createService(bundle); } }
HttpServiceFactoryImpl implements ServiceFactory<HttpService> { @Override public HttpService getService(final Bundle bundle, final ServiceRegistration<HttpService> serviceRegistration) { LOG.info("Binding bundle: [" + bundle + "] to http service"); return createService(bundle); } @Override HttpService getService(fin...
HttpServiceFactoryImpl implements ServiceFactory<HttpService> { @Override public HttpService getService(final Bundle bundle, final ServiceRegistration<HttpService> serviceRegistration) { LOG.info("Binding bundle: [" + bundle + "] to http service"); return createService(bundle); } @Override HttpService getService(fin...
@Test public void checkUngetServiceFlow() { httpService.stop(); replay(bundle, serviceRegistration, httpService); underTest.ungetService(bundle, serviceRegistration, httpService); verify(bundle, serviceRegistration, httpService); }
@Override public void ungetService(final Bundle bundle, final ServiceRegistration<HttpService> serviceRegistration, final HttpService httpService) { LOG.info("Unbinding bundle: [" + bundle + "]"); ((StoppableHttpService) httpService).stop(); }
HttpServiceFactoryImpl implements ServiceFactory<HttpService> { @Override public void ungetService(final Bundle bundle, final ServiceRegistration<HttpService> serviceRegistration, final HttpService httpService) { LOG.info("Unbinding bundle: [" + bundle + "]"); ((StoppableHttpService) httpService).stop(); } }
HttpServiceFactoryImpl implements ServiceFactory<HttpService> { @Override public void ungetService(final Bundle bundle, final ServiceRegistration<HttpService> serviceRegistration, final HttpService httpService) { LOG.info("Unbinding bundle: [" + bundle + "]"); ((StoppableHttpService) httpService).stop(); } }
HttpServiceFactoryImpl implements ServiceFactory<HttpService> { @Override public void ungetService(final Bundle bundle, final ServiceRegistration<HttpService> serviceRegistration, final HttpService httpService) { LOG.info("Unbinding bundle: [" + bundle + "]"); ((StoppableHttpService) httpService).stop(); } @Override...
HttpServiceFactoryImpl implements ServiceFactory<HttpService> { @Override public void ungetService(final Bundle bundle, final ServiceRegistration<HttpService> serviceRegistration, final HttpService httpService) { LOG.info("Unbinding bundle: [" + bundle + "]"); ((StoppableHttpService) httpService).stop(); } @Override...
@Test public void handleSecurity() throws IOException { assertTrue(contextUnderTest.handleSecurity(null, null)); }
@Override public boolean handleSecurity(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws IOException { return true; }
DefaultHttpContext implements WebContainerContext { @Override public boolean handleSecurity(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws IOException { return true; } }
DefaultHttpContext implements WebContainerContext { @Override public boolean handleSecurity(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws IOException { return true; } DefaultHttpContext(final Bundle bundle, String contextID); }
DefaultHttpContext implements WebContainerContext { @Override public boolean handleSecurity(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws IOException { return true; } DefaultHttpContext(final Bundle bundle, String contextID); @Override boolean handleSecurity(final Ht...
DefaultHttpContext implements WebContainerContext { @Override public boolean handleSecurity(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws IOException { return true; } DefaultHttpContext(final Bundle bundle, String contextID); @Override boolean handleSecurity(final Ht...
@SuppressWarnings("unchecked") @Test public void getOrCreateContextDoesNotRegisterMultipleServletContextsForSameContextModelMultiThreaded() throws Exception { final JettyServerWrapper jettyServerWrapperUnderTest = new JettyServerWrapper( serverModelMock, new QueuedThreadPool()); try { jettyServerWrapperUnderTest.start(...
HttpServiceContext getOrCreateContext(final Model model) { return getOrCreateContext(model.getContextModel()); }
JettyServerWrapper extends Server { HttpServiceContext getOrCreateContext(final Model model) { return getOrCreateContext(model.getContextModel()); } }
JettyServerWrapper extends Server { HttpServiceContext getOrCreateContext(final Model model) { return getOrCreateContext(model.getContextModel()); } JettyServerWrapper(ServerModel serverModel, ThreadPool threadPool); }
JettyServerWrapper extends Server { HttpServiceContext getOrCreateContext(final Model model) { return getOrCreateContext(model.getContextModel()); } JettyServerWrapper(ServerModel serverModel, ThreadPool threadPool); HandlerCollection getRootHandlerCollection(); void configureContext(final Map<String, Object> attribute...
JettyServerWrapper extends Server { HttpServiceContext getOrCreateContext(final Model model) { return getOrCreateContext(model.getContextModel()); } JettyServerWrapper(ServerModel serverModel, ThreadPool threadPool); HandlerCollection getRootHandlerCollection(); void configureContext(final Map<String, Object> attribute...
@Test public void getMimeType() { assertEquals(null, contextUnderTest.getMimeType(null)); }
@Override public String getMimeType(String name) { return null; }
DefaultHttpContext implements WebContainerContext { @Override public String getMimeType(String name) { return null; } }
DefaultHttpContext implements WebContainerContext { @Override public String getMimeType(String name) { return null; } DefaultHttpContext(final Bundle bundle, String contextID); }
DefaultHttpContext implements WebContainerContext { @Override public String getMimeType(String name) { return null; } DefaultHttpContext(final Bundle bundle, String contextID); @Override boolean handleSecurity(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse); @Overri...
DefaultHttpContext implements WebContainerContext { @Override public String getMimeType(String name) { return null; } DefaultHttpContext(final Bundle bundle, String contextID); @Override boolean handleSecurity(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse); @Overri...
@Test public void getResource() throws MalformedURLException { URL url = new URL("file: expect(bundle.getResource("test")).andReturn(url); replay(bundle); contextUnderTest.getResource("test"); verify(bundle); }
@Override public URL getResource(final String name) { final String normalizedname = Path.normalizeResourcePath(name); LOG.debug("Searching bundle [" + bundle + "] for resource [" + normalizedname + "]"); return bundle.getResource(normalizedname); }
DefaultHttpContext implements WebContainerContext { @Override public URL getResource(final String name) { final String normalizedname = Path.normalizeResourcePath(name); LOG.debug("Searching bundle [" + bundle + "] for resource [" + normalizedname + "]"); return bundle.getResource(normalizedname); } }
DefaultHttpContext implements WebContainerContext { @Override public URL getResource(final String name) { final String normalizedname = Path.normalizeResourcePath(name); LOG.debug("Searching bundle [" + bundle + "] for resource [" + normalizedname + "]"); return bundle.getResource(normalizedname); } DefaultHttpContext(...
DefaultHttpContext implements WebContainerContext { @Override public URL getResource(final String name) { final String normalizedname = Path.normalizeResourcePath(name); LOG.debug("Searching bundle [" + bundle + "] for resource [" + normalizedname + "]"); return bundle.getResource(normalizedname); } DefaultHttpContext(...
DefaultHttpContext implements WebContainerContext { @Override public URL getResource(final String name) { final String normalizedname = Path.normalizeResourcePath(name); LOG.debug("Searching bundle [" + bundle + "] for resource [" + normalizedname + "]"); return bundle.getResource(normalizedname); } DefaultHttpContext(...
@Test public void replaceSlashesWithNull() { assertEquals("Replaced", null, Path.replaceSlashes(null)); }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
@Test public void replaceSlashes01() { assertEquals("Replaced", "/foo/bar/", Path.replaceSlashes("/foo/bar/")); }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
@Test public void replaceSlashes02() { assertEquals("Replaced", "/", Path.replaceSlashes("/")); }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
@Test public void replaceSlashes03() { assertEquals("Replaced", "/", Path.replaceSlashes(" }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
@Test public void replaceSlashes04() { assertEquals("Replaced", "/foo/bar", Path.replaceSlashes(" }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
@Test public void replaceSlashes05() { assertEquals("Replaced", "foo/bar/", Path.replaceSlashes("foo/bar }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
@Test public void replaceSlashes06() { assertEquals("Replaced", "foo/bar", Path.replaceSlashes("foo }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
@Test public void replaceSlashes07() { assertEquals("Replaced", "/foo/bar/car/", Path.replaceSlashes("/foo }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String[] normalizePatterns(final String[] urlPatterns); static Stri...
@Test public void registrationAndUnregistrationOfTwoServletsThereShouldBeNoContexts() throws Exception { JettyServerImpl server = new JettyServerImpl(serverModelMock, null); server.start(); try { Bundle testBundle = mock(Bundle.class); ContextModel contextModel = new ContextModel(httpContextMock, testBundle, getClass()...
HttpServiceContext getContext(final HttpContext httpContext) { readLock.lock(); try { ServletContextInfo servletContextInfo = contexts.get(httpContext); if (servletContextInfo != null) { return servletContextInfo.getHandler(); } return null; } finally { readLock.unlock(); } }
JettyServerWrapper extends Server { HttpServiceContext getContext(final HttpContext httpContext) { readLock.lock(); try { ServletContextInfo servletContextInfo = contexts.get(httpContext); if (servletContextInfo != null) { return servletContextInfo.getHandler(); } return null; } finally { readLock.unlock(); } } }
JettyServerWrapper extends Server { HttpServiceContext getContext(final HttpContext httpContext) { readLock.lock(); try { ServletContextInfo servletContextInfo = contexts.get(httpContext); if (servletContextInfo != null) { return servletContextInfo.getHandler(); } return null; } finally { readLock.unlock(); } } JettySe...
JettyServerWrapper extends Server { HttpServiceContext getContext(final HttpContext httpContext) { readLock.lock(); try { ServletContextInfo servletContextInfo = contexts.get(httpContext); if (servletContextInfo != null) { return servletContextInfo.getHandler(); } return null; } finally { readLock.unlock(); } } JettySe...
JettyServerWrapper extends Server { HttpServiceContext getContext(final HttpContext httpContext) { readLock.lock(); try { ServletContextInfo servletContextInfo = contexts.get(httpContext); if (servletContextInfo != null) { return servletContextInfo.getHandler(); } return null; } finally { readLock.unlock(); } } JettySe...
@Test public void normalizeResourcePathSlash01() { assertEquals("Normalized", "/", Path.normalizeResourcePath("/")); }
public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
@Test public void normalizeResourcePathSlash02() { assertEquals("Normalized", "/", Path.normalizeResourcePath(" /")); }
public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
@Test public void normalizeResourcePathSlash03() { assertEquals("Normalized", "/", Path.normalizeResourcePath(" / ")); }
public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
@Test public void normalizeResourcePathSlash04() { assertEquals("Normalized", "/", Path.normalizeResourcePath("/ ")); }
public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); }
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
Path { public static String normalizeResourcePath(final String path) { if (path == null) { return null; } String normalizedPath = replaceSlashes(path.trim()); if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) { normalizedPath = normalizedPath.substring(1); } return normalizedPath; } private Path(); st...
@Test public void registerWithNoDispatcherInitParams() { FilterModel fm = new FilterModel(new ContextModel( createMock(WebContainerContext.class), null, getClass() .getClassLoader(), null), createMock(Filter.class), new String[]{"/*"}, null, new Hashtable<>(), false); System.out.println(Arrays.asList(fm.getDispatcher()...
public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); }
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } }
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } FilterModel(final ContextModel contextModel, final Filter filter, final String[] urlPatterns, final String[] servletNames, final Dictionary<String, ?> initParameter, final boolean as...
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } FilterModel(final ContextModel contextModel, final Filter filter, final String[] urlPatterns, final String[] servletNames, final Dictionary<String, ?> initParameter, final boolean as...
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } FilterModel(final ContextModel contextModel, final Filter filter, final String[] urlPatterns, final String[] servletNames, final Dictionary<String, ?> initParameter, final boolean as...
@Test public void registerWithCorrectSubsetOfDispatcherInitParams() { FilterModel fm = new FilterModel(new ContextModel( createMock(WebContainerContext.class), null, getClass() .getClassLoader(), null), createMock(Filter.class), new String[]{" private static final long serialVersionUID = 6291128067491953259L; { put(Web...
public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); }
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } }
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } FilterModel(final ContextModel contextModel, final Filter filter, final String[] urlPatterns, final String[] servletNames, final Dictionary<String, ?> initParameter, final boolean as...
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } FilterModel(final ContextModel contextModel, final Filter filter, final String[] urlPatterns, final String[] servletNames, final Dictionary<String, ?> initParameter, final boolean as...
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } FilterModel(final ContextModel contextModel, final Filter filter, final String[] urlPatterns, final String[] servletNames, final Dictionary<String, ?> initParameter, final boolean as...
@Test public void registerWithFullComplimentOfDispatcherInitParams() { FilterModel fm = new FilterModel(new ContextModel( createMock(WebContainerContext.class), null, getClass() .getClassLoader(), null), createMock(Filter.class), new String[]{" private static final long serialVersionUID = 4025173284250768044L; { put(We...
public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); }
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } }
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } FilterModel(final ContextModel contextModel, final Filter filter, final String[] urlPatterns, final String[] servletNames, final Dictionary<String, ?> initParameter, final boolean as...
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } FilterModel(final ContextModel contextModel, final Filter filter, final String[] urlPatterns, final String[] servletNames, final Dictionary<String, ?> initParameter, final boolean as...
FilterModel extends Model { public String[] getDispatcher() { return dispatcher.toArray(new String[dispatcher.size()]); } FilterModel(final ContextModel contextModel, final Filter filter, final String[] urlPatterns, final String[] servletNames, final Dictionary<String, ?> initParameter, final boolean as...
@Test public void replaceSlashesWithNull() { assertEquals("Replaced", null, Path.replaceSlashes(null)); }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
@Test public void replaceSlashes01() { assertEquals("Replaced", "/foo/bar/", Path.replaceSlashes("/foo/bar/")); }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
@Test public void replaceSlashes02() { assertEquals("Replaced", "/", Path.replaceSlashes("/")); }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
@Test public void replaceSlashes03() { assertEquals("Replaced", "/", Path.replaceSlashes(" }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
@Test public void replaceSlashes04() { assertEquals("Replaced", "/foo/bar", Path.replaceSlashes(" }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
@Test public void replaceSlashes05() { assertEquals("Replaced", "foo/bar/", Path.replaceSlashes("foo/bar }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
@Test public void replaceSlashes06() { assertEquals("Replaced", "foo/bar", Path.replaceSlashes("foo }
static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
Path { static String replaceSlashes(final String target) { String replaced = target; if (replaced != null) { replaced = replaced.replaceAll("/+", "/"); } return replaced; } private Path(); static String normalizeResourcePath(final String path); static String getDirectParent(URL entry); }
@Test public void testCreateDirectoryStructure() { System.out.println("createDirectoryStructure"); String path = System.getProperty("user.home"); String project = "Test"; boolean expResult = true; boolean result = FileTools.createBlankProject(path, project); assertEquals(expResult, result); }
public static boolean createBlankProject(String path, String projectName) { boolean result = true; result &= createDirectory(path + File.separator + projectName); result &= createAssetDirectories(path + File.separator + projectName); return result; }
FileTools { public static boolean createBlankProject(String path, String projectName) { boolean result = true; result &= createDirectory(path + File.separator + projectName); result &= createAssetDirectories(path + File.separator + projectName); return result; } }
FileTools { public static boolean createBlankProject(String path, String projectName) { boolean result = true; result &= createDirectory(path + File.separator + projectName); result &= createAssetDirectories(path + File.separator + projectName); return result; } }
FileTools { public static boolean createBlankProject(String path, String projectName) { boolean result = true; result &= createDirectory(path + File.separator + projectName); result &= createAssetDirectories(path + File.separator + projectName); return result; } static String getJreDirectory(); static String getBuilds...
FileTools { public static boolean createBlankProject(String path, String projectName) { boolean result = true; result &= createDirectory(path + File.separator + projectName); result &= createAssetDirectories(path + File.separator + projectName); return result; } static String getJreDirectory(); static String getBuilds...
@Test @Ignore public void testDoChoosePath() { System.out.println("doChoosePath"); File expResult = null; File result = FileTools.doChoosePath(); assertEquals(expResult, result); fail("The test case is a prototype."); }
public static File doChoosePath() { JFileChooser fileChooser = new JFileChooser(System.getProperty("user.home")); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (fileChooser.showOpenDialog(MainWindow.getInstance()) == JFileChooser.APPROVE_OPTION) { return fileChooser.getCurrentDirectory(); } return...
FileTools { public static File doChoosePath() { JFileChooser fileChooser = new JFileChooser(System.getProperty("user.home")); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (fileChooser.showOpenDialog(MainWindow.getInstance()) == JFileChooser.APPROVE_OPTION) { return fileChooser.getCurrentDirectory...
FileTools { public static File doChoosePath() { JFileChooser fileChooser = new JFileChooser(System.getProperty("user.home")); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (fileChooser.showOpenDialog(MainWindow.getInstance()) == JFileChooser.APPROVE_OPTION) { return fileChooser.getCurrentDirectory...
FileTools { public static File doChoosePath() { JFileChooser fileChooser = new JFileChooser(System.getProperty("user.home")); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (fileChooser.showOpenDialog(MainWindow.getInstance()) == JFileChooser.APPROVE_OPTION) { return fileChooser.getCurrentDirectory...
FileTools { public static File doChoosePath() { JFileChooser fileChooser = new JFileChooser(System.getProperty("user.home")); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (fileChooser.showOpenDialog(MainWindow.getInstance()) == JFileChooser.APPROVE_OPTION) { return fileChooser.getCurrentDirectory...
@Test @Ignore public void testDoChooseFile() { System.out.println("doChooseFile"); String extension = ""; String directory = ""; String type = ""; File expResult = null; File result = FileTools.doChooseFile(extension, directory, type); assertEquals(expResult, result); fail("The test case is a prototype."); }
public static File doChooseFile(String extension, String directory, String type) { if (MainWindow.getInstance().getActiveProject() != null) { File projectPath = new File(System.getProperty("project.path") + File.separator + directory); if (projectPath.exists()) { JFileChooser fileChooser = new JFileChooser(new SingleRo...
FileTools { public static File doChooseFile(String extension, String directory, String type) { if (MainWindow.getInstance().getActiveProject() != null) { File projectPath = new File(System.getProperty("project.path") + File.separator + directory); if (projectPath.exists()) { JFileChooser fileChooser = new JFileChooser(...
FileTools { public static File doChooseFile(String extension, String directory, String type) { if (MainWindow.getInstance().getActiveProject() != null) { File projectPath = new File(System.getProperty("project.path") + File.separator + directory); if (projectPath.exists()) { JFileChooser fileChooser = new JFileChooser(...
FileTools { public static File doChooseFile(String extension, String directory, String type) { if (MainWindow.getInstance().getActiveProject() != null) { File projectPath = new File(System.getProperty("project.path") + File.separator + directory); if (projectPath.exists()) { JFileChooser fileChooser = new JFileChooser(...
FileTools { public static File doChooseFile(String extension, String directory, String type) { if (MainWindow.getInstance().getActiveProject() != null) { File projectPath = new File(System.getProperty("project.path") + File.separator + directory); if (projectPath.exists()) { JFileChooser fileChooser = new JFileChooser(...
@Test public void testAesEncrypt() { try { WXBizMsgCrypt pc = new WXBizMsgCrypt(token, encodingAesKey, appId); assertEquals(afterAesEncrypt, pc.encrypt(randomStr, replyMsg)); } catch (AesException e) { e.printStackTrace(); fail("no异常"); } }
String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] appidBytes = appId.getBytes(CHARSET); b...
WXBizMsgCrypt { String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] appidBytes = appId.getB...
WXBizMsgCrypt { String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] appidBytes = appId.getB...
WXBizMsgCrypt { String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] appidBytes = appId.getB...
WXBizMsgCrypt { String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] appidBytes = appId.getB...
@Test public void testAesEncrypt2() { try { WXBizMsgCrypt pc = new WXBizMsgCrypt(token, encodingAesKey, appId); assertEquals(afterAesEncrypt2, pc.encrypt(randomStr, replyMsg2)); } catch (AesException e) { e.printStackTrace(); fail("no异常"); } }
String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] appidBytes = appId.getBytes(CHARSET); b...
WXBizMsgCrypt { String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] appidBytes = appId.getB...
WXBizMsgCrypt { String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] appidBytes = appId.getB...
WXBizMsgCrypt { String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] appidBytes = appId.getB...
WXBizMsgCrypt { String encrypt(String randomStr, String text) throws AesException { ByteGroup byteCollector = new ByteGroup(); byte[] randomStrBytes = randomStr.getBytes(CHARSET); byte[] textBytes = text.getBytes(CHARSET); byte[] networkBytesOrder = getNetworkBytesOrder(textBytes.length); byte[] appidBytes = appId.getB...
@Test public void testIsValidPartnerAgreement() throws IOException { JSONCPARepository repository = new JSONCPARepository(); repository.setCpaJsonFile(fileFromClasspath("agreementWithServices.json")); repository.init(); Map<String,Object> fields = new ImmutableMap.Builder<String, Object>() .put(EbmsConstants.CPA, repos...
public boolean isValidPartnerAgreement(final Map<String, Object> fields) { PartnerAgreement agreement = (PartnerAgreement) fields.get(EbmsConstants.CPA); return agreement != null; }
JSONCPARepository implements CPARepository { public boolean isValidPartnerAgreement(final Map<String, Object> fields) { PartnerAgreement agreement = (PartnerAgreement) fields.get(EbmsConstants.CPA); return agreement != null; } }
JSONCPARepository implements CPARepository { public boolean isValidPartnerAgreement(final Map<String, Object> fields) { PartnerAgreement agreement = (PartnerAgreement) fields.get(EbmsConstants.CPA); return agreement != null; } }
JSONCPARepository implements CPARepository { public boolean isValidPartnerAgreement(final Map<String, Object> fields) { PartnerAgreement agreement = (PartnerAgreement) fields.get(EbmsConstants.CPA); return agreement != null; } void init(); @Override List<PartnerAgreement> getPartnerAgreements(); @Override List<Partner...
JSONCPARepository implements CPARepository { public boolean isValidPartnerAgreement(final Map<String, Object> fields) { PartnerAgreement agreement = (PartnerAgreement) fields.get(EbmsConstants.CPA); return agreement != null; } void init(); @Override List<PartnerAgreement> getPartnerAgreements(); @Override List<Partner...
@Test public void testFileMessageStore() throws IOException { Exchange request = new DefaultExchange(context()); request.getIn().setHeader(EbmsConstants.EBMS_VERSION,EbmsConstants.EBMS_V3); request.getIn().setHeader(EbmsConstants.MESSAGE_ID,"testMessageID"); request.getIn().setBody(new ByteArrayInputStream("test".getBy...
@Override public Message findByMessageId(final String messageId, String messageDirection) { return new DefaultMessage(messageId); }
FileMessageStore implements MessageStore { @Override public Message findByMessageId(final String messageId, String messageDirection) { return new DefaultMessage(messageId); } }
FileMessageStore implements MessageStore { @Override public Message findByMessageId(final String messageId, String messageDirection) { return new DefaultMessage(messageId); } }
FileMessageStore implements MessageStore { @Override public Message findByMessageId(final String messageId, String messageDirection) { return new DefaultMessage(messageId); } @Override void store(@Body InputStream input, Exchange exchange); @Override void storeMessage(Exchange exchange); @Override Message findByMessag...
FileMessageStore implements MessageStore { @Override public Message findByMessageId(final String messageId, String messageDirection) { return new DefaultMessage(messageId); } @Override void store(@Body InputStream input, Exchange exchange); @Override void storeMessage(Exchange exchange); @Override Message findByMessag...
@Test public void testFindPayloadById() throws Exception { testFileMessageStore(); InputStream stream = messageStore.findPayloadById("testMessageID"); assertThat(IOUtils.toString(stream),equalTo("test")); }
@Override public InputStream findPayloadById(String messageId) { try { return new FileInputStream(getFilename(messageId)); } catch (FileNotFoundException e) { return null; } }
FileMessageStore implements MessageStore { @Override public InputStream findPayloadById(String messageId) { try { return new FileInputStream(getFilename(messageId)); } catch (FileNotFoundException e) { return null; } } }
FileMessageStore implements MessageStore { @Override public InputStream findPayloadById(String messageId) { try { return new FileInputStream(getFilename(messageId)); } catch (FileNotFoundException e) { return null; } } }
FileMessageStore implements MessageStore { @Override public InputStream findPayloadById(String messageId) { try { return new FileInputStream(getFilename(messageId)); } catch (FileNotFoundException e) { return null; } } @Override void store(@Body InputStream input, Exchange exchange); @Override void storeMessage(Exchan...
FileMessageStore implements MessageStore { @Override public InputStream findPayloadById(String messageId) { try { return new FileInputStream(getFilename(messageId)); } catch (FileNotFoundException e) { return null; } } @Override void store(@Body InputStream input, Exchange exchange); @Override void storeMessage(Exchan...
@Test public void testExtractPartProperties() { assertThat(EbmsUtils.extractPartProperties(null), hasSize(0)); assertThat(EbmsUtils.extractPartProperties(""), hasSize(0)); assertThat(EbmsUtils.extractPartProperties(";"), hasSize(0)); assertThat(EbmsUtils.extractPartProperties(";;"), hasSize(0)); List<Map<String,Object>...
public static List<Map<String, Object>> extractPartProperties(String partProperties) { List<Map<String,Object>> properites = new ArrayList<>(); if(partProperties != null && partProperties.length() > 0) { String [] propertyArray = partProperties.split(";"); for (String property : propertyArray) { String [] value = prope...
EbmsUtils { public static List<Map<String, Object>> extractPartProperties(String partProperties) { List<Map<String,Object>> properites = new ArrayList<>(); if(partProperties != null && partProperties.length() > 0) { String [] propertyArray = partProperties.split(";"); for (String property : propertyArray) { String [] v...
EbmsUtils { public static List<Map<String, Object>> extractPartProperties(String partProperties) { List<Map<String,Object>> properites = new ArrayList<>(); if(partProperties != null && partProperties.length() > 0) { String [] propertyArray = partProperties.split(";"); for (String property : propertyArray) { String [] v...
EbmsUtils { public static List<Map<String, Object>> extractPartProperties(String partProperties) { List<Map<String,Object>> properites = new ArrayList<>(); if(partProperties != null && partProperties.length() > 0) { String [] propertyArray = partProperties.split(";"); for (String property : propertyArray) { String [] v...
EbmsUtils { public static List<Map<String, Object>> extractPartProperties(String partProperties) { List<Map<String,Object>> properites = new ArrayList<>(); if(partProperties != null && partProperties.length() > 0) { String [] propertyArray = partProperties.split(";"); for (String property : propertyArray) { String [] v...
@Test public void testSoap12SignMessage() throws Exception { MessageDetector messageDetector = new MessageDetector(); Map<String,Object> headers = new HashMap<>(); InputStream stream = new ByteArrayInputStream(EbmsUtils.toStringFromClasspath("signal-message.xml").getBytes()); messageDetector.parse(stream,headers); asse...
public void parse(@Body InputStream input, @Headers Map<String, Object> headers) throws IOException { try { byte [] msgData = new byte[20480]; int count = input.read(msgData); if(count > 0) { String msg = new String(msgData); String soapVersion = msg.contains(EbmsConstants.SOAP_1_2_NAMESPACE) ? SOAPConstants.SOAP_1_2_P...
MessageDetector { public void parse(@Body InputStream input, @Headers Map<String, Object> headers) throws IOException { try { byte [] msgData = new byte[20480]; int count = input.read(msgData); if(count > 0) { String msg = new String(msgData); String soapVersion = msg.contains(EbmsConstants.SOAP_1_2_NAMESPACE) ? SOAPCo...
MessageDetector { public void parse(@Body InputStream input, @Headers Map<String, Object> headers) throws IOException { try { byte [] msgData = new byte[20480]; int count = input.read(msgData); if(count > 0) { String msg = new String(msgData); String soapVersion = msg.contains(EbmsConstants.SOAP_1_2_NAMESPACE) ? SOAPCo...
MessageDetector { public void parse(@Body InputStream input, @Headers Map<String, Object> headers) throws IOException { try { byte [] msgData = new byte[20480]; int count = input.read(msgData); if(count > 0) { String msg = new String(msgData); String soapVersion = msg.contains(EbmsConstants.SOAP_1_2_NAMESPACE) ? SOAPCo...
MessageDetector { public void parse(@Body InputStream input, @Headers Map<String, Object> headers) throws IOException { try { byte [] msgData = new byte[20480]; int count = input.read(msgData); if(count > 0) { String msg = new String(msgData); String soapVersion = msg.contains(EbmsConstants.SOAP_1_2_NAMESPACE) ? SOAPCo...
@Test public void testSoap12SignReceipt() throws Exception { MessageDetector messageDetector = new MessageDetector(); Map<String,Object> headers = new HashMap<>(); InputStream stream = new ByteArrayInputStream(EbmsUtils.toStringFromClasspath("signed-receipt.xml").getBytes()); messageDetector.parse(stream,headers); asse...
public void parse(@Body InputStream input, @Headers Map<String, Object> headers) throws IOException { try { byte [] msgData = new byte[20480]; int count = input.read(msgData); if(count > 0) { String msg = new String(msgData); String soapVersion = msg.contains(EbmsConstants.SOAP_1_2_NAMESPACE) ? SOAPConstants.SOAP_1_2_P...
MessageDetector { public void parse(@Body InputStream input, @Headers Map<String, Object> headers) throws IOException { try { byte [] msgData = new byte[20480]; int count = input.read(msgData); if(count > 0) { String msg = new String(msgData); String soapVersion = msg.contains(EbmsConstants.SOAP_1_2_NAMESPACE) ? SOAPCo...
MessageDetector { public void parse(@Body InputStream input, @Headers Map<String, Object> headers) throws IOException { try { byte [] msgData = new byte[20480]; int count = input.read(msgData); if(count > 0) { String msg = new String(msgData); String soapVersion = msg.contains(EbmsConstants.SOAP_1_2_NAMESPACE) ? SOAPCo...
MessageDetector { public void parse(@Body InputStream input, @Headers Map<String, Object> headers) throws IOException { try { byte [] msgData = new byte[20480]; int count = input.read(msgData); if(count > 0) { String msg = new String(msgData); String soapVersion = msg.contains(EbmsConstants.SOAP_1_2_NAMESPACE) ? SOAPCo...
MessageDetector { public void parse(@Body InputStream input, @Headers Map<String, Object> headers) throws IOException { try { byte [] msgData = new byte[20480]; int count = input.read(msgData); if(count > 0) { String msg = new String(msgData); String soapVersion = msg.contains(EbmsConstants.SOAP_1_2_NAMESPACE) ? SOAPCo...
@Test public void testUpdateStoreMimeMessage() throws Exception { File body = fileFromClasspath("simple-as4-receipt.xml"); String contentType = "Multipart/Related; boundary=\"----=_Part_7_10584188.1123489648993\"; type=\"application/soap+xml\"; start=\"<soapPart@jentrata.org>\""; String messageId = "testMimeMessage1"; ...
@Override public void updateMessage(String messageId, String messageDirection, MessageStatusType status, String statusDescription) { repositoryManager.updateMessage(messageId,messageDirection,status,statusDescription); }
JDBCMessageStore implements MessageStore { @Override public void updateMessage(String messageId, String messageDirection, MessageStatusType status, String statusDescription) { repositoryManager.updateMessage(messageId,messageDirection,status,statusDescription); } }
JDBCMessageStore implements MessageStore { @Override public void updateMessage(String messageId, String messageDirection, MessageStatusType status, String statusDescription) { repositoryManager.updateMessage(messageId,messageDirection,status,statusDescription); } }
JDBCMessageStore implements MessageStore { @Override public void updateMessage(String messageId, String messageDirection, MessageStatusType status, String statusDescription) { repositoryManager.updateMessage(messageId,messageDirection,status,statusDescription); } void init(); @Override void store(InputStream message, ...
JDBCMessageStore implements MessageStore { @Override public void updateMessage(String messageId, String messageDirection, MessageStatusType status, String statusDescription) { repositoryManager.updateMessage(messageId,messageDirection,status,statusDescription); } void init(); @Override void store(InputStream message, ...
@Test public void testFindByMessageId() throws Exception { String contentType = "application/soap+xml"; File body = fileFromClasspath("simple-as4-receipt.xml"); String messageId = "testSoapMessage1"; assertStoredMessage(messageId, contentType, body, MessageType.SIGNAL_MESSAGE_WITH_USER_MESSAGE); messageStore.updateMess...
@Override public Message findByMessageId(String messageId, String messageDirection) { Map<String,Object> fields = new HashMap<>(); fields.put("message_id",messageId); fields.put("message_box",messageDirection); List<Message> messages = repositoryManager.selectMessageBy(fields); if(messages.size() > 0) { return messages...
JDBCMessageStore implements MessageStore { @Override public Message findByMessageId(String messageId, String messageDirection) { Map<String,Object> fields = new HashMap<>(); fields.put("message_id",messageId); fields.put("message_box",messageDirection); List<Message> messages = repositoryManager.selectMessageBy(fields)...
JDBCMessageStore implements MessageStore { @Override public Message findByMessageId(String messageId, String messageDirection) { Map<String,Object> fields = new HashMap<>(); fields.put("message_id",messageId); fields.put("message_box",messageDirection); List<Message> messages = repositoryManager.selectMessageBy(fields)...
JDBCMessageStore implements MessageStore { @Override public Message findByMessageId(String messageId, String messageDirection) { Map<String,Object> fields = new HashMap<>(); fields.put("message_id",messageId); fields.put("message_box",messageDirection); List<Message> messages = repositoryManager.selectMessageBy(fields)...
JDBCMessageStore implements MessageStore { @Override public Message findByMessageId(String messageId, String messageDirection) { Map<String,Object> fields = new HashMap<>(); fields.put("message_id",messageId); fields.put("message_box",messageDirection); List<Message> messages = repositoryManager.selectMessageBy(fields)...
@Test public void testFindPayloadById() throws Exception { testFindByMessageId(); InputStream stream = messageStore.findPayloadById("testSoapMessage1"); assertThat(stream,notNullValue()); assertThat(IOUtils.toString(stream),equalTo(IOUtils.toString(new FileInputStream(fileFromClasspath("simple-as4-receipt.xml"))))); }
@Override public InputStream findPayloadById(String messageId) { InputStream payload = repositoryManager.selectRepositoryBy("message_id",messageId); return payload; }
JDBCMessageStore implements MessageStore { @Override public InputStream findPayloadById(String messageId) { InputStream payload = repositoryManager.selectRepositoryBy("message_id",messageId); return payload; } }
JDBCMessageStore implements MessageStore { @Override public InputStream findPayloadById(String messageId) { InputStream payload = repositoryManager.selectRepositoryBy("message_id",messageId); return payload; } }
JDBCMessageStore implements MessageStore { @Override public InputStream findPayloadById(String messageId) { InputStream payload = repositoryManager.selectRepositoryBy("message_id",messageId); return payload; } void init(); @Override void store(InputStream message, Exchange exchange); void storeMessage(Exchange exchang...
JDBCMessageStore implements MessageStore { @Override public InputStream findPayloadById(String messageId) { InputStream payload = repositoryManager.selectRepositoryBy("message_id",messageId); return payload; } void init(); @Override void store(InputStream message, Exchange exchange); void storeMessage(Exchange exchang...
@Test public void testFindMessageByStatus() throws Exception { testFindByMessageId(); List<Message> messages = messageStore.findByMessageStatus(EbmsConstants.MESSAGE_DIRECTION_INBOUND,MessageStatusType.RECEIVED.name()); assertThat(messages,notNullValue()); assertThat(messages,hasSize(1)); Message message = messages.get...
@Override public List<Message> findByMessageStatus(String messageDirection, String status) { Map<String,Object> fields = new HashMap<>(); fields.put("status",status); fields.put("message_box",messageDirection); fields.put("orderByDesc","time_stamp"); fields.put("maxResults",100); List<Message> messages = repositoryMana...
JDBCMessageStore implements MessageStore { @Override public List<Message> findByMessageStatus(String messageDirection, String status) { Map<String,Object> fields = new HashMap<>(); fields.put("status",status); fields.put("message_box",messageDirection); fields.put("orderByDesc","time_stamp"); fields.put("maxResults",10...
JDBCMessageStore implements MessageStore { @Override public List<Message> findByMessageStatus(String messageDirection, String status) { Map<String,Object> fields = new HashMap<>(); fields.put("status",status); fields.put("message_box",messageDirection); fields.put("orderByDesc","time_stamp"); fields.put("maxResults",10...
JDBCMessageStore implements MessageStore { @Override public List<Message> findByMessageStatus(String messageDirection, String status) { Map<String,Object> fields = new HashMap<>(); fields.put("status",status); fields.put("message_box",messageDirection); fields.put("orderByDesc","time_stamp"); fields.put("maxResults",10...
JDBCMessageStore implements MessageStore { @Override public List<Message> findByMessageStatus(String messageDirection, String status) { Map<String,Object> fields = new HashMap<>(); fields.put("status",status); fields.put("message_box",messageDirection); fields.put("orderByDesc","time_stamp"); fields.put("maxResults",10...
@Test public void testGet() { AvailableSegment<TestItem> a = new AvailableSegment<>(model, 2); assertEquals(20, a.getFrom()); assertEquals(30, a.getTo()); assertEquals(2, a.getPage()); a.dataProvided(TestItem.range(20, 30)); assertEquals("p.20", a.get(20).toString()); assertEquals("p.29", a.get(29).toString()); assertN...
public ITEM get(int position) { if (items == null) { return null; } if (covered(position)) { int index = position - getFrom(); return index < items.size() ? items.get(index) : null; } return null; }
AvailableSegment extends Segment implements Serializable { public ITEM get(int position) { if (items == null) { return null; } if (covered(position)) { int index = position - getFrom(); return index < items.size() ? items.get(index) : null; } return null; } }
AvailableSegment extends Segment implements Serializable { public ITEM get(int position) { if (items == null) { return null; } if (covered(position)) { int index = position - getFrom(); return index < items.size() ? items.get(index) : null; } return null; } AvailableSegment(UncoveringDataModel<?> model, int page); }
AvailableSegment extends Segment implements Serializable { public ITEM get(int position) { if (items == null) { return null; } if (covered(position)) { int index = position - getFrom(); return index < items.size() ? items.get(index) : null; } return null; } AvailableSegment(UncoveringDataModel<?> model, int page); int ...
AvailableSegment extends Segment implements Serializable { public ITEM get(int position) { if (items == null) { return null; } if (covered(position)) { int index = position - getFrom(); return index < items.size() ? items.get(index) : null; } return null; } AvailableSegment(UncoveringDataModel<?> model, int page); int ...
@Test public void testCovered() { AvailableSegment<TestItem> a = new AvailableSegment<>(model, 2); when(model.getPage(anyInt())).thenReturn(2); assertTrue(a.covered(0)); when(model.getPage(anyInt())).thenReturn(1); assertFalse(a.covered(0)); }
public boolean covered(int position) { return model.getPage(position) == page; }
AvailableSegment extends Segment implements Serializable { public boolean covered(int position) { return model.getPage(position) == page; } }
AvailableSegment extends Segment implements Serializable { public boolean covered(int position) { return model.getPage(position) == page; } AvailableSegment(UncoveringDataModel<?> model, int page); }
AvailableSegment extends Segment implements Serializable { public boolean covered(int position) { return model.getPage(position) == page; } AvailableSegment(UncoveringDataModel<?> model, int page); int getMaxIndex(); ITEM get(int position); boolean covered(int position); void dataProvided(List<ITEM> items); void dataPr...
AvailableSegment extends Segment implements Serializable { public boolean covered(int position) { return model.getPage(position) == page; } AvailableSegment(UncoveringDataModel<?> model, int page); int getMaxIndex(); ITEM get(int position); boolean covered(int position); void dataProvided(List<ITEM> items); void dataPr...
@Test public void testDataProvided() { AvailableSegment<TestItem> a = new AvailableSegment<>(model, 2); assertNull(a.get(20)); assertNull(a.get(29)); assertNull(a.get(19)); assertNull(a.get(30)); assertEquals(0, a.getMaxIndex()); a.dataProvided(TestItem.range(20, 29)); assertEquals("p.20", a.get(20).toString()); assert...
public void dataProvided(List<ITEM> items) { if (items == null) { dataProvided(items, 0); } else { dataProvided(items, getFrom() + items.size()); } }
AvailableSegment extends Segment implements Serializable { public void dataProvided(List<ITEM> items) { if (items == null) { dataProvided(items, 0); } else { dataProvided(items, getFrom() + items.size()); } } }
AvailableSegment extends Segment implements Serializable { public void dataProvided(List<ITEM> items) { if (items == null) { dataProvided(items, 0); } else { dataProvided(items, getFrom() + items.size()); } } AvailableSegment(UncoveringDataModel<?> model, int page); }
AvailableSegment extends Segment implements Serializable { public void dataProvided(List<ITEM> items) { if (items == null) { dataProvided(items, 0); } else { dataProvided(items, getFrom() + items.size()); } } AvailableSegment(UncoveringDataModel<?> model, int page); int getMaxIndex(); ITEM get(int position); boolean co...
AvailableSegment extends Segment implements Serializable { public void dataProvided(List<ITEM> items) { if (items == null) { dataProvided(items, 0); } else { dataProvided(items, getFrom() + items.size()); } } AvailableSegment(UncoveringDataModel<?> model, int page); int getMaxIndex(); ITEM get(int position); boolean co...
@Test public void testSegment() { UncoveringDataModel<TestItem> model = mock(UncoveringDataModel.class); when(model.getPageSize()).thenReturn(10); Segment s = new Segment(model, 20); assertEquals(200, s.getFrom()); assertEquals(210, s.getTo()); assertEquals(20, s.getPage()); }
public Segment(UncoveringDataModel<ITEM> model, int page) { this.model = model; this.page = page; }
Segment implements Serializable { public Segment(UncoveringDataModel<ITEM> model, int page) { this.model = model; this.page = page; } }
Segment implements Serializable { public Segment(UncoveringDataModel<ITEM> model, int page) { this.model = model; this.page = page; } Segment(UncoveringDataModel<ITEM> model, int page); }
Segment implements Serializable { public Segment(UncoveringDataModel<ITEM> model, int page) { this.model = model; this.page = page; } Segment(UncoveringDataModel<ITEM> model, int page); int getFrom(); int getTo(); int getPage(); @Override boolean equals(Object o); void setModel(UncoveringDataModel<ITEM> model); @Overri...
Segment implements Serializable { public Segment(UncoveringDataModel<ITEM> model, int page) { this.model = model; this.page = page; } Segment(UncoveringDataModel<ITEM> model, int page); int getFrom(); int getTo(); int getPage(); @Override boolean equals(Object o); void setModel(UncoveringDataModel<ITEM> model); @Overri...
@Test public void testRequestData() throws Exception { DataFetchManager<TestItem> fetcher = new DataFetchManager<>(); fetcher.setDataFetcher(primary); fetcher.setDataModel(model); fetcher.setDelayWhenPending(700); fetcher.setThreads(1); int pg2 = 2; int pg10 = 10; int pg20 = 20; int pg50 = 50; AvailableSegment<TestItem...
public synchronized void requestData(int page) { AvailableSegment<ITEM> segment = new AvailableSegment<>(dataModel, page); PrimaryRequest request = new PrimaryRequest(segment.getFrom(), segment.getTo(), dataModel.getQuery(), dataModel.isFirstQueryResult()); request.setPage(segment.getPage()); coverage.put(segment.getPa...
DataFetchManager implements DataAvailableListener<ITEM> { public synchronized void requestData(int page) { AvailableSegment<ITEM> segment = new AvailableSegment<>(dataModel, page); PrimaryRequest request = new PrimaryRequest(segment.getFrom(), segment.getTo(), dataModel.getQuery(), dataModel.isFirstQueryResult()); requ...
DataFetchManager implements DataAvailableListener<ITEM> { public synchronized void requestData(int page) { AvailableSegment<ITEM> segment = new AvailableSegment<>(dataModel, page); PrimaryRequest request = new PrimaryRequest(segment.getFrom(), segment.getTo(), dataModel.getQuery(), dataModel.isFirstQueryResult()); requ...
DataFetchManager implements DataAvailableListener<ITEM> { public synchronized void requestData(int page) { AvailableSegment<ITEM> segment = new AvailableSegment<>(dataModel, page); PrimaryRequest request = new PrimaryRequest(segment.getFrom(), segment.getTo(), dataModel.getQuery(), dataModel.isFirstQueryResult()); requ...
DataFetchManager implements DataAvailableListener<ITEM> { public synchronized void requestData(int page) { AvailableSegment<ITEM> segment = new AvailableSegment<>(dataModel, page); PrimaryRequest request = new PrimaryRequest(segment.getFrom(), segment.getTo(), dataModel.getQuery(), dataModel.isFirstQueryResult()); requ...
@Test public void shouldLoadForecastWeather() throws ParseException, IOException { final ThreeHoursForecastWeather item = Fakes.fakeResponse(Responses.JSON.THREE_HOUR_FORECAST); doReturn(Observable.just(item)) .when(weatherApi).getForecastWeather(anyDouble(), anyDouble()); TestObserver<ThreeHoursForecastWeather> testOb...
public Observable<ThreeHoursForecastWeather> getForecastWeather(double longitude, double latitude) { return api.getForecastWeather(longitude, latitude) .subscribeOn(scheduler) .take(1); }
WeatherService { public Observable<ThreeHoursForecastWeather> getForecastWeather(double longitude, double latitude) { return api.getForecastWeather(longitude, latitude) .subscribeOn(scheduler) .take(1); } }
WeatherService { public Observable<ThreeHoursForecastWeather> getForecastWeather(double longitude, double latitude) { return api.getForecastWeather(longitude, latitude) .subscribeOn(scheduler) .take(1); } @Inject WeatherService(WeatherApi api, @RxScheduler(NETWORK) Scheduler scheduler, ImageRequestManager imageRequest...
WeatherService { public Observable<ThreeHoursForecastWeather> getForecastWeather(double longitude, double latitude) { return api.getForecastWeather(longitude, latitude) .subscribeOn(scheduler) .take(1); } @Inject WeatherService(WeatherApi api, @RxScheduler(NETWORK) Scheduler scheduler, ImageRequestManager imageRequest...
WeatherService { public Observable<ThreeHoursForecastWeather> getForecastWeather(double longitude, double latitude) { return api.getForecastWeather(longitude, latitude) .subscribeOn(scheduler) .take(1); } @Inject WeatherService(WeatherApi api, @RxScheduler(NETWORK) Scheduler scheduler, ImageRequestManager imageRequest...
@Test public void searchApiFunctionIsCalled() { final TestObserver<SearchModel> observer = new TestObserver<>(); searchService.searchByCity(CITY).subscribe(observer); verify(weatherApi).searchWeather(CITY); observer.assertSubscribed() .assertNoErrors() .assertComplete() .assertValue(item); }
public Observable<SearchModel> searchByCity(String city) { lastCity = city; return api.searchWeather(city).subscribeOn(this.scheduler); }
SearchService { public Observable<SearchModel> searchByCity(String city) { lastCity = city; return api.searchWeather(city).subscribeOn(this.scheduler); } }
SearchService { public Observable<SearchModel> searchByCity(String city) { lastCity = city; return api.searchWeather(city).subscribeOn(this.scheduler); } @Inject SearchService(WeatherApi api, @RxScheduler(NETWORK) Scheduler scheduler); }
SearchService { public Observable<SearchModel> searchByCity(String city) { lastCity = city; return api.searchWeather(city).subscribeOn(this.scheduler); } @Inject SearchService(WeatherApi api, @RxScheduler(NETWORK) Scheduler scheduler); Observable<SearchModel> searchByCity(String city); String getLastSearch(); }
SearchService { public Observable<SearchModel> searchByCity(String city) { lastCity = city; return api.searchWeather(city).subscribeOn(this.scheduler); } @Inject SearchService(WeatherApi api, @RxScheduler(NETWORK) Scheduler scheduler); Observable<SearchModel> searchByCity(String city); String getLastSearch(); }
@Test public void shouldNotLoadForecastsIfNoLocationIsPresent() { when(locationService.lastLocation()).thenReturn(null); vm.onViewAttached(); vm.loadForecastWeatherDataForTomorrow(); verifyZeroInteractions(weatherService); }
public void loadForecastWeatherDataForTomorrow() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted(); weatherService.getForecastWeather(longitude, ...
TomorrowWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForTomorrow() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStar...
TomorrowWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForTomorrow() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStar...
TomorrowWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForTomorrow() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStar...
TomorrowWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForTomorrow() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStar...
@Test public void shouldLoadForecastsIfLocationIsPresent() throws ParseException, IOException { double longitude = 1.0; double latitude = 1.0; final Location location = mockLocation(mock(Location.class), 1.0, 1.0); when(locationService.lastLocation()).thenReturn(location); String expectedResult = Responses.createExpect...
public void loadForecastWeatherDataForTomorrow() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted(); weatherService.getForecastWeather(longitude, ...
TomorrowWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForTomorrow() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStar...
TomorrowWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForTomorrow() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStar...
TomorrowWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForTomorrow() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStar...
TomorrowWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForTomorrow() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStar...
@Test public void shouldNotLoadForecastsIfNoLocationIsPresent() { when(locationService.lastLocation()).thenReturn(null); vm.onViewAttached(); vm.loadForecastWeatherDataForToday(); verifyZeroInteractions(weatherService); }
public void loadForecastWeatherDataForToday() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted(); weatherService.getForecastWeather(longitude, lat...
TodayWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForToday() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted();...
TodayWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForToday() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted();...
TodayWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForToday() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted();...
TodayWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForToday() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted();...
@Test public void shouldLoadForecastsIfLocationIsPresent() throws ParseException, IOException { double longitude = 1.0; double latitude = 1.0; final Location location = mockLocation(mock(Location.class), 1.0, 1.0); when(locationService.lastLocation()).thenReturn(location); String expectedResult = Responses.createExpect...
public void loadForecastWeatherDataForToday() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted(); weatherService.getForecastWeather(longitude, lat...
TodayWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForToday() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted();...
TodayWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForToday() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted();...
TodayWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForToday() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted();...
TodayWeatherViewModel extends WeatherViewModel { public void loadForecastWeatherDataForToday() { Location lastKnownLocation = locationService.lastLocation(); if (lastKnownLocation != null) { double longitude = lastKnownLocation.getLongitude(); double latitude = lastKnownLocation.getLatitude(); dispatchRequestStarted();...
@Test public void testCheckReset_IMMEDIATELY() { SyncTrigger syncTrigger = new SyncTrigger( () -> mockTrigger.triggered(), () -> mockThreshold.shouldTrigger(), IMMEDIATELY); when(mockThreshold.shouldTrigger()).thenReturn(false); syncTrigger.check(); verify(mockTrigger, never()).triggered(); verify(mockThreshold, times(...
public void check(){ check(false); }
SyncTrigger { public void check(){ check(false); } }
SyncTrigger { public void check(){ check(false); } SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold); SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold, ResetRule resetRule); }
SyncTrigger { public void check(){ check(false); } SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold); SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold, ResetRule resetRule); void check(); void checkLazy(); }
SyncTrigger { public void check(){ check(false); } SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold); SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold, ResetRule resetRule); void check(); void checkLazy(); }
@Test public void testMultipleSpaceText_mediumWidthAvailable() { List<String> wrappedLines = BasicTextWrapper.wrapMonospaceText(DOUBLE_SPACE_TEXT, MEDIUM_CHARACTERS_AVAILABLE); Assert.assertEquals(FIRST_LINE_DOUBLE_SPACE, wrappedLines.get(0)); Assert.assertEquals("-multi space text", wrappedLines.get(1)); Assert.assert...
public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithExtractedLineBreaks ...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
@Test public void testLineBreakText_mediumWidthAvailable() { List<String> wrappedLines = BasicTextWrapper.wrapMonospaceText(LINE_BREAK_TEXT, MEDIUM_CHARACTERS_AVAILABLE); Assert.assertEquals(FIRST_LINE_LINE_BREAK, wrappedLines.get(0)); Assert.assertEquals("fox jumped over the abc defghi", wrappedLines.get(1)); Assert.a...
public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithExtractedLineBreaks ...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
@Test public void testLongText_zeroWidthAvailable() { boolean exceptionThrown = false; try { List<String> wrappedLines = BasicTextWrapper.wrapMonospaceText(LONG_TEXT, ZERO_CHARACTERS_AVAILABLE); } catch (IllegalArgumentException e) { exceptionThrown = true; } Assert.assertEquals(true, exceptionThrown); }
public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithExtractedLineBreaks ...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
@Test public void testPaddingOnTheRight() { String paddedText = TextPadder.padText(TEXT_ORIG, 10, TextPadder.Pad.RIGHT, '+'); Assert.assertEquals(TEXT_ORIG + "+++++++", paddedText); }
public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOriginal is alread...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
@Test public void testPaddingOnTheLeft() { String paddedText = TextPadder.padText(TEXT_ORIG, 10, TextPadder.Pad.LEFT, '*'); Assert.assertEquals("*******" + TEXT_ORIG, paddedText); }
public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOriginal is alread...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
@Test public void testPaddingWhenAlreadyPadded() { String paddedText = TextPadder.padText(TEXT_ORIG, 3, TextPadder.Pad.LEFT, PADDING_CHARACTER); Assert.assertEquals(TEXT_ORIG, paddedText); }
public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOriginal is alread...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
@Test public void testPaddingIllegalValues() { try { TextPadder.padText(null, 3, TextPadder.Pad.LEFT, PADDING_CHARACTER); Assert.fail("should have thrown an exception by now: original text was null"); } catch (Exception e) { } try { TextPadder.padText(TEXT_ORIG, 3, null, PADDING_CHARACTER); Assert.fail("should have thr...
public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOriginal is alread...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
TextPadder { public static String padText(String textOriginal, int desiredLength, Pad pad, char paddingCharacter) { Affirm.notNull(textOriginal); Affirm.notNull(pad); int paddingCharactersRequired = desiredLength - textOriginal.length(); if (paddingCharactersRequired < 0) { throw new IllegalArgumentException("textOrigi...
@Test public void observersNotifiedAtLeastOnce() throws Exception { CounterWithProgress counterWithProgress = new CounterWithProgress(WorkMode.SYNCHRONOUS, logger); Observer mockObserver = mock(Observer.class); counterWithProgress.addObserver(mockObserver); counterWithProgress.increaseBy20(); verify(mockObserver, atLea...
@SuppressLint("StaticFieldLeak") public void increaseBy20(){ logger.i(TAG, "increaseBy20()"); isBusy = true; notifyObservers(); new Async<Void, Integer, Integer>(workMode) { @Override protected Integer doInBackground(Void... voids) { int totalIncrease = 0; for (int ii=0; ii<20; ii++) { synchronized (this) { try { wait(...
CounterWithProgress extends ObservableImp { @SuppressLint("StaticFieldLeak") public void increaseBy20(){ logger.i(TAG, "increaseBy20()"); isBusy = true; notifyObservers(); new Async<Void, Integer, Integer>(workMode) { @Override protected Integer doInBackground(Void... voids) { int totalIncrease = 0; for (int ii=0; ii<2...
CounterWithProgress extends ObservableImp { @SuppressLint("StaticFieldLeak") public void increaseBy20(){ logger.i(TAG, "increaseBy20()"); isBusy = true; notifyObservers(); new Async<Void, Integer, Integer>(workMode) { @Override protected Integer doInBackground(Void... voids) { int totalIncrease = 0; for (int ii=0; ii<2...
CounterWithProgress extends ObservableImp { @SuppressLint("StaticFieldLeak") public void increaseBy20(){ logger.i(TAG, "increaseBy20()"); isBusy = true; notifyObservers(); new Async<Void, Integer, Integer>(workMode) { @Override protected Integer doInBackground(Void... voids) { int totalIncrease = 0; for (int ii=0; ii<2...
CounterWithProgress extends ObservableImp { @SuppressLint("StaticFieldLeak") public void increaseBy20(){ logger.i(TAG, "increaseBy20()"); isBusy = true; notifyObservers(); new Async<Void, Integer, Integer>(workMode) { @Override protected Integer doInBackground(Void... voids) { int totalIncrease = 0; for (int ii=0; ii<2...
@Test public void observersNotifiedAtLeastOnce() throws Exception { CounterWithLambdas counterWithLambdas = new CounterWithLambdas(WorkMode.SYNCHRONOUS, logger); Observer mockObserver = mock(Observer.class); counterWithLambdas.addObserver(mockObserver); counterWithLambdas.increaseBy20(); verify(mockObserver, atLeastOnc...
public void increaseBy20(){ logger.i(TAG, "increaseBy20()"); isBusy = true; notifyObservers(); new AsyncBuilder<Void, Integer>(workMode) .doInBackground(input -> CounterWithLambdas.this.doStuffInBackground(input)) .onPostExecute(result -> CounterWithLambdas.this.doThingsWithTheResult(result)) .execute((Void) null); }
CounterWithLambdas extends ObservableImp { public void increaseBy20(){ logger.i(TAG, "increaseBy20()"); isBusy = true; notifyObservers(); new AsyncBuilder<Void, Integer>(workMode) .doInBackground(input -> CounterWithLambdas.this.doStuffInBackground(input)) .onPostExecute(result -> CounterWithLambdas.this.doThingsWithTh...
CounterWithLambdas extends ObservableImp { public void increaseBy20(){ logger.i(TAG, "increaseBy20()"); isBusy = true; notifyObservers(); new AsyncBuilder<Void, Integer>(workMode) .doInBackground(input -> CounterWithLambdas.this.doStuffInBackground(input)) .onPostExecute(result -> CounterWithLambdas.this.doThingsWithTh...
CounterWithLambdas extends ObservableImp { public void increaseBy20(){ logger.i(TAG, "increaseBy20()"); isBusy = true; notifyObservers(); new AsyncBuilder<Void, Integer>(workMode) .doInBackground(input -> CounterWithLambdas.this.doStuffInBackground(input)) .onPostExecute(result -> CounterWithLambdas.this.doThingsWithTh...
CounterWithLambdas extends ObservableImp { public void increaseBy20(){ logger.i(TAG, "increaseBy20()"); isBusy = true; notifyObservers(); new AsyncBuilder<Void, Integer>(workMode) .doInBackground(input -> CounterWithLambdas.this.doStuffInBackground(input)) .onPostExecute(result -> CounterWithLambdas.this.doThingsWithTh...
@Test public void addNewTrack() throws Exception { PlaylistAdvancedModel playlistAdvancedModel = new PlaylistAdvancedModel(mockSystemTimeWrapper, WorkMode.SYNCHRONOUS, logger); playlistAdvancedModel.addNewTrack(); Assert.assertEquals(1, playlistAdvancedModel.getTrackListSize()); Assert.assertEquals(1, playlistAdvancedM...
public void addNewTrack() { logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void addNewTrack() { logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void addNewTrack() { logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void addNewTrack() { logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrack();...
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void addNewTrack() { logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrack();...
@Test public void testCheckReset_ONLY_AFTER_REVERSION() { SyncTrigger syncTrigger = new SyncTrigger( () -> mockTrigger.triggered(), () -> mockThreshold.shouldTrigger(), ONLY_AFTER_REVERSION); when(mockThreshold.shouldTrigger()).thenReturn(false); syncTrigger.check(); verify(mockTrigger, never()).triggered(); verify(moc...
public void check(){ check(false); }
SyncTrigger { public void check(){ check(false); } }
SyncTrigger { public void check(){ check(false); } SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold); SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold, ResetRule resetRule); }
SyncTrigger { public void check(){ check(false); } SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold); SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold, ResetRule resetRule); void check(); void checkLazy(); }
SyncTrigger { public void check(){ check(false); } SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold); SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold, ResetRule resetRule); void check(); void checkLazy(); }
@Test public void removeTrack() throws Exception { PlaylistAdvancedModel playlistAdvancedModel = new PlaylistAdvancedModel(mockSystemTimeWrapper, WorkMode.SYNCHRONOUS, logger); playlistAdvancedModel.addNewTrack(); playlistAdvancedModel.removeTrack(0); Assert.assertEquals(0, playlistAdvancedModel.getTrackListSize()); }
public void removeTrack(int index) { logger.i(TAG, "removeTrack() " + index); checkIndex(index); trackList.remove(index); notifyObservers(); }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void removeTrack(int index) { logger.i(TAG, "removeTrack() " + index); checkIndex(index); trackList.remove(index); notifyObservers(); } }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void removeTrack(int index) { logger.i(TAG, "removeTrack() " + index); checkIndex(index); trackList.remove(index); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void removeTrack(int index) { logger.i(TAG, "removeTrack() " + index); checkIndex(index); trackList.remove(index); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrac...
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void removeTrack(int index) { logger.i(TAG, "removeTrack() " + index); checkIndex(index); trackList.remove(index); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrac...
@Test public void add5NewTracks() throws Exception { PlaylistAdvancedModel playlistAdvancedModel = new PlaylistAdvancedModel(mockSystemTimeWrapper, WorkMode.SYNCHRONOUS, logger); playlistAdvancedModel.add5NewTracks(); Assert.assertEquals(5, playlistAdvancedModel.getTrackListSize()); Assert.assertEquals(1, playlistAdvan...
public void add5NewTracks() { logger.i(TAG, "add5NewTracks()"); List<Track> newTracks = new ArrayList<>(); for (int ii=0; ii<5; ii++){ newTracks.add(new Track(generateRandomColourResource())); } trackList.addAll(0, newTracks); notifyObservers(); }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void add5NewTracks() { logger.i(TAG, "add5NewTracks()"); List<Track> newTracks = new ArrayList<>(); for (int ii=0; ii<5; ii++){ newTracks.add(new Track(generateRandomColourResource())); } trackList.addAll(0, newTracks); notifyObservers(); } }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void add5NewTracks() { logger.i(TAG, "add5NewTracks()"); List<Track> newTracks = new ArrayList<>(); for (int ii=0; ii<5; ii++){ newTracks.add(new Track(generateRandomColourResource())); } trackList.addAll(0, newTracks); notifyObservers(); } Play...
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void add5NewTracks() { logger.i(TAG, "add5NewTracks()"); List<Track> newTracks = new ArrayList<>(); for (int ii=0; ii<5; ii++){ newTracks.add(new Track(generateRandomColourResource())); } trackList.addAll(0, newTracks); notifyObservers(); } Play...
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void add5NewTracks() { logger.i(TAG, "add5NewTracks()"); List<Track> newTracks = new ArrayList<>(); for (int ii=0; ii<5; ii++){ newTracks.add(new Track(generateRandomColourResource())); } trackList.addAll(0, newTracks); notifyObservers(); } Play...
@Test public void remove5Tracks() throws Exception { PlaylistAdvancedModel playlistAdvancedModel = new PlaylistAdvancedModel(mockSystemTimeWrapper, WorkMode.SYNCHRONOUS, logger); playlistAdvancedModel.add5NewTracks(); playlistAdvancedModel.remove5Tracks(); Assert.assertEquals(0, playlistAdvancedModel.getTrackListSize()...
public void remove5Tracks() { logger.i(TAG, "remove5Tracks()"); if (getTrackListSize()>4){ trackList.removeRange(0, 5); notifyObservers(); } }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void remove5Tracks() { logger.i(TAG, "remove5Tracks()"); if (getTrackListSize()>4){ trackList.removeRange(0, 5); notifyObservers(); } } }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void remove5Tracks() { logger.i(TAG, "remove5Tracks()"); if (getTrackListSize()>4){ trackList.removeRange(0, 5); notifyObservers(); } } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void remove5Tracks() { logger.i(TAG, "remove5Tracks()"); if (getTrackListSize()>4){ trackList.removeRange(0, 5); notifyObservers(); } } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrac...
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void remove5Tracks() { logger.i(TAG, "remove5Tracks()"); if (getTrackListSize()>4){ trackList.removeRange(0, 5); notifyObservers(); } } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrac...
@Test public void removeAllTracks() throws Exception { PlaylistAdvancedModel playlistAdvancedModel = new PlaylistAdvancedModel(mockSystemTimeWrapper, WorkMode.SYNCHRONOUS, logger); playlistAdvancedModel.add5NewTracks(); playlistAdvancedModel.addNewTrack(); playlistAdvancedModel.addNewTrack(); playlistAdvancedModel.remo...
public void removeAllTracks() { logger.i(TAG, "removeAllTracks()"); trackList.clear(); notifyObservers(); }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void removeAllTracks() { logger.i(TAG, "removeAllTracks()"); trackList.clear(); notifyObservers(); } }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void removeAllTracks() { logger.i(TAG, "removeAllTracks()"); trackList.clear(); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void removeAllTracks() { logger.i(TAG, "removeAllTracks()"); trackList.clear(); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); v...
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void removeAllTracks() { logger.i(TAG, "removeAllTracks()"); trackList.clear(); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); v...
@Test public void observersNotifiedAtLeastOnceForAddTrack() throws Exception { PlaylistAdvancedModel playlistAdvancedModel = new PlaylistAdvancedModel(mockSystemTimeWrapper, WorkMode.SYNCHRONOUS, logger); Observer mockObserver = mock(Observer.class); playlistAdvancedModel.addObserver(mockObserver); playlistAdvancedMode...
public void addNewTrack() { logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void addNewTrack() { logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void addNewTrack() { logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); }
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void addNewTrack() { logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrack();...
PlaylistAdvancedModel extends ObservableImp implements Updateable { public void addNewTrack() { logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistAdvancedModel(SystemTimeWrapper systemTimeWrapper, WorkMode workMode, Logger logger); void addNewTrack();...
@Test public void initialConditions() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); Assert.assertEquals(0, playlistSimpleModel.getTrackListSize()); Assert.assertEquals(false, playlistSimpleModel.hasObservers()); }
public int getTrackListSize(){ return trackList.size(); }
PlaylistSimpleModel extends ObservableImp { public int getTrackListSize(){ return trackList.size(); } }
PlaylistSimpleModel extends ObservableImp { public int getTrackListSize(){ return trackList.size(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); }
PlaylistSimpleModel extends ObservableImp { public int getTrackListSize(){ return trackList.size(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTra...
PlaylistSimpleModel extends ObservableImp { public int getTrackListSize(){ return trackList.size(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); void decreasePlaysForTrack(int index); Track getTra...
@Test public void addNewTrack() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); playlistSimpleModel.addNewTrack(); Assert.assertEquals(1, playlistSimpleModel.getTrackListSize()); Assert.assertEquals(1, playlistSimpleModel.getTrack(0).getNumberOfPlaysRe...
public void addNewTrack(){ logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); }
PlaylistSimpleModel extends ObservableImp { public void addNewTrack(){ logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } }
PlaylistSimpleModel extends ObservableImp { public void addNewTrack(){ logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); }
PlaylistSimpleModel extends ObservableImp { public void addNewTrack(){ logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void incre...
PlaylistSimpleModel extends ObservableImp { public void addNewTrack(){ logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void incre...
@Test public void removeTrack() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); playlistSimpleModel.addNewTrack(); playlistSimpleModel.removeTrack(0); Assert.assertEquals(0, playlistSimpleModel.getTrackListSize()); }
public void removeTrack(int index){ logger.i(TAG, "removeTrack() "+index); checkIndex(index); trackList.remove(index); notifyObservers(); }
PlaylistSimpleModel extends ObservableImp { public void removeTrack(int index){ logger.i(TAG, "removeTrack() "+index); checkIndex(index); trackList.remove(index); notifyObservers(); } }
PlaylistSimpleModel extends ObservableImp { public void removeTrack(int index){ logger.i(TAG, "removeTrack() "+index); checkIndex(index); trackList.remove(index); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); }
PlaylistSimpleModel extends ObservableImp { public void removeTrack(int index){ logger.i(TAG, "removeTrack() "+index); checkIndex(index); trackList.remove(index); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void inc...
PlaylistSimpleModel extends ObservableImp { public void removeTrack(int index){ logger.i(TAG, "removeTrack() "+index); checkIndex(index); trackList.remove(index); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void inc...
@Test public void add5NewTracks() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); playlistSimpleModel.add5NewTracks(); Assert.assertEquals(5, playlistSimpleModel.getTrackListSize()); Assert.assertEquals(1, playlistSimpleModel.getTrack(4).getNumberOfPla...
public void add5NewTracks() { logger.i(TAG, "add5NewTracks()"); List<Track> newTracks = new ArrayList<>(); for (int ii=0; ii<5; ii++){ newTracks.add(new Track(generateRandomColourResource())); } trackList.addAll(0, newTracks); notifyObservers(); }
PlaylistSimpleModel extends ObservableImp { public void add5NewTracks() { logger.i(TAG, "add5NewTracks()"); List<Track> newTracks = new ArrayList<>(); for (int ii=0; ii<5; ii++){ newTracks.add(new Track(generateRandomColourResource())); } trackList.addAll(0, newTracks); notifyObservers(); } }
PlaylistSimpleModel extends ObservableImp { public void add5NewTracks() { logger.i(TAG, "add5NewTracks()"); List<Track> newTracks = new ArrayList<>(); for (int ii=0; ii<5; ii++){ newTracks.add(new Track(generateRandomColourResource())); } trackList.addAll(0, newTracks); notifyObservers(); } PlaylistSimpleModel(WorkMode...
PlaylistSimpleModel extends ObservableImp { public void add5NewTracks() { logger.i(TAG, "add5NewTracks()"); List<Track> newTracks = new ArrayList<>(); for (int ii=0; ii<5; ii++){ newTracks.add(new Track(generateRandomColourResource())); } trackList.addAll(0, newTracks); notifyObservers(); } PlaylistSimpleModel(WorkMode...
PlaylistSimpleModel extends ObservableImp { public void add5NewTracks() { logger.i(TAG, "add5NewTracks()"); List<Track> newTracks = new ArrayList<>(); for (int ii=0; ii<5; ii++){ newTracks.add(new Track(generateRandomColourResource())); } trackList.addAll(0, newTracks); notifyObservers(); } PlaylistSimpleModel(WorkMode...
@Test public void remove5Tracks() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); playlistSimpleModel.add5NewTracks(); playlistSimpleModel.remove5Tracks(); Assert.assertEquals(0, playlistSimpleModel.getTrackListSize()); }
public void remove5Tracks() { logger.i(TAG, "remove5Tracks()"); if (getTrackListSize()>4){ trackList.subList(0, 5).clear(); notifyObservers(); } }
PlaylistSimpleModel extends ObservableImp { public void remove5Tracks() { logger.i(TAG, "remove5Tracks()"); if (getTrackListSize()>4){ trackList.subList(0, 5).clear(); notifyObservers(); } } }
PlaylistSimpleModel extends ObservableImp { public void remove5Tracks() { logger.i(TAG, "remove5Tracks()"); if (getTrackListSize()>4){ trackList.subList(0, 5).clear(); notifyObservers(); } } PlaylistSimpleModel(WorkMode workMode, Logger logger); }
PlaylistSimpleModel extends ObservableImp { public void remove5Tracks() { logger.i(TAG, "remove5Tracks()"); if (getTrackListSize()>4){ trackList.subList(0, 5).clear(); notifyObservers(); } } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); v...
PlaylistSimpleModel extends ObservableImp { public void remove5Tracks() { logger.i(TAG, "remove5Tracks()"); if (getTrackListSize()>4){ trackList.subList(0, 5).clear(); notifyObservers(); } } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); v...
@Test public void testCheckReset_NEVER() { SyncTrigger syncTrigger = new SyncTrigger( () -> mockTrigger.triggered(), () -> mockThreshold.shouldTrigger(), NEVER); when(mockThreshold.shouldTrigger()).thenReturn(false); syncTrigger.check(); verify(mockTrigger, never()).triggered(); verify(mockThreshold, times(1)).shouldTr...
public void check(){ check(false); }
SyncTrigger { public void check(){ check(false); } }
SyncTrigger { public void check(){ check(false); } SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold); SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold, ResetRule resetRule); }
SyncTrigger { public void check(){ check(false); } SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold); SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold, ResetRule resetRule); void check(); void checkLazy(); }
SyncTrigger { public void check(){ check(false); } SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold); SyncTrigger(DoThisWhenTriggered doThisWhenTriggered, CheckTriggerThreshold checkTriggerThreshold, ResetRule resetRule); void check(); void checkLazy(); }
@Test public void removeAllTracks() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); playlistSimpleModel.add5NewTracks(); playlistSimpleModel.addNewTrack(); playlistSimpleModel.addNewTrack(); playlistSimpleModel.removeAllTracks(); Assert.assertEquals(0,...
public void removeAllTracks() { logger.i(TAG, "removeAllTracks()"); trackList.clear(); notifyObservers(); }
PlaylistSimpleModel extends ObservableImp { public void removeAllTracks() { logger.i(TAG, "removeAllTracks()"); trackList.clear(); notifyObservers(); } }
PlaylistSimpleModel extends ObservableImp { public void removeAllTracks() { logger.i(TAG, "removeAllTracks()"); trackList.clear(); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); }
PlaylistSimpleModel extends ObservableImp { public void removeAllTracks() { logger.i(TAG, "removeAllTracks()"); trackList.clear(); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); v...
PlaylistSimpleModel extends ObservableImp { public void removeAllTracks() { logger.i(TAG, "removeAllTracks()"); trackList.clear(); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void increasePlaysForTrack(int index); v...
@Test public void observersNotifiedAtLeastOnceForAddTrack() throws Exception { PlaylistSimpleModel playlistSimpleModel = new PlaylistSimpleModel(WorkMode.SYNCHRONOUS, logger); Observer mockObserver = mock(Observer.class); playlistSimpleModel.addObserver(mockObserver); playlistSimpleModel.addNewTrack(); verify(mockObser...
public void addNewTrack(){ logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); }
PlaylistSimpleModel extends ObservableImp { public void addNewTrack(){ logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } }
PlaylistSimpleModel extends ObservableImp { public void addNewTrack(){ logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); }
PlaylistSimpleModel extends ObservableImp { public void addNewTrack(){ logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void incre...
PlaylistSimpleModel extends ObservableImp { public void addNewTrack(){ logger.i(TAG, "addNewTrack()"); trackList.add(new Track(generateRandomColourResource())); notifyObservers(); } PlaylistSimpleModel(WorkMode workMode, Logger logger); void addNewTrack(); void removeTrack(int index); void removeAllTracks(); void incre...
@Test public void increaseMobileWallet() throws Exception { Wallet wallet = new Wallet(logger); wallet.increaseMobileWallet(); Assert.assertEquals(true, wallet.canIncrease()); Assert.assertEquals(true, wallet.canDecrease()); Assert.assertEquals(wallet.totalDollarsAvailable - 1, wallet.getSavingsWalletAmount()); Assert....
public void increaseMobileWallet() { if (canIncrease()) { mobileWalletDollars++; logger.i(TAG, "Increasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } }
Wallet extends ObservableImp { public void increaseMobileWallet() { if (canIncrease()) { mobileWalletDollars++; logger.i(TAG, "Increasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } }
Wallet extends ObservableImp { public void increaseMobileWallet() { if (canIncrease()) { mobileWalletDollars++; logger.i(TAG, "Increasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } Wallet(Logger logger); }
Wallet extends ObservableImp { public void increaseMobileWallet() { if (canIncrease()) { mobileWalletDollars++; logger.i(TAG, "Increasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } Wallet(Logger logger); void increaseMobileWallet(); void decreaseMobileWallet(); int getMobileWalletAmount(); int ge...
Wallet extends ObservableImp { public void increaseMobileWallet() { if (canIncrease()) { mobileWalletDollars++; logger.i(TAG, "Increasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } Wallet(Logger logger); void increaseMobileWallet(); void decreaseMobileWallet(); int getMobileWalletAmount(); int ge...
@Test public void decreaseMobileWallet() throws Exception { Wallet wallet = new Wallet(logger); wallet.increaseMobileWallet(); Assert.assertEquals(1, wallet.getMobileWalletAmount()); wallet.decreaseMobileWallet(); Assert.assertEquals(true, wallet.canIncrease()); Assert.assertEquals(false, wallet.canDecrease()); Assert....
public void decreaseMobileWallet(){ if (canDecrease()) { mobileWalletDollars--; logger.i(TAG, "Decreasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } }
Wallet extends ObservableImp { public void decreaseMobileWallet(){ if (canDecrease()) { mobileWalletDollars--; logger.i(TAG, "Decreasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } }
Wallet extends ObservableImp { public void decreaseMobileWallet(){ if (canDecrease()) { mobileWalletDollars--; logger.i(TAG, "Decreasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } Wallet(Logger logger); }
Wallet extends ObservableImp { public void decreaseMobileWallet(){ if (canDecrease()) { mobileWalletDollars--; logger.i(TAG, "Decreasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } Wallet(Logger logger); void increaseMobileWallet(); void decreaseMobileWallet(); int getMobileWalletAmount(); int get...
Wallet extends ObservableImp { public void decreaseMobileWallet(){ if (canDecrease()) { mobileWalletDollars--; logger.i(TAG, "Decreasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } Wallet(Logger logger); void increaseMobileWallet(); void decreaseMobileWallet(); int getMobileWalletAmount(); int get...
@Test public void observersNotifiedAtLeastOnceForIncrease() throws Exception { Wallet wallet = new Wallet(logger); Observer mockObserver = mock(Observer.class); wallet.addObserver(mockObserver); wallet.increaseMobileWallet(); verify(mockObserver, atLeastOnce()).somethingChanged(); }
public void increaseMobileWallet() { if (canIncrease()) { mobileWalletDollars++; logger.i(TAG, "Increasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } }
Wallet extends ObservableImp { public void increaseMobileWallet() { if (canIncrease()) { mobileWalletDollars++; logger.i(TAG, "Increasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } }
Wallet extends ObservableImp { public void increaseMobileWallet() { if (canIncrease()) { mobileWalletDollars++; logger.i(TAG, "Increasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } Wallet(Logger logger); }
Wallet extends ObservableImp { public void increaseMobileWallet() { if (canIncrease()) { mobileWalletDollars++; logger.i(TAG, "Increasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } Wallet(Logger logger); void increaseMobileWallet(); void decreaseMobileWallet(); int getMobileWalletAmount(); int ge...
Wallet extends ObservableImp { public void increaseMobileWallet() { if (canIncrease()) { mobileWalletDollars++; logger.i(TAG, "Increasing mobile wallet to:" + mobileWalletDollars); notifyObservers(); } } Wallet(Logger logger); void increaseMobileWallet(); void decreaseMobileWallet(); int getMobileWalletAmount(); int ge...
@Test public void testMediumText_mediumWidthAvailable() { List<String> wrappedLines = BasicTextWrapper.wrapMonospaceText(LONG_TEXT, MEDIUM_CHARACTERS_AVAILABLE); Assert.assertEquals(FIRST_LINE, wrappedLines.get(0)); Assert.assertEquals(SECOND_LINE, wrappedLines.get(1)); Assert.assertEquals(THIRD_LINE, wrappedLines.get(...
public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithExtractedLineBreaks ...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
@Test public void testSmallText_mediumWidthAvailable() { List<String> wrappedLines = BasicTextWrapper.wrapMonospaceText(SHORT_TEXT, MEDIUM_CHARACTERS_AVAILABLE); Assert.assertEquals(SHORT_TEXT, wrappedLines.get(0)); Assert.assertEquals(1, wrappedLines.size()); }
public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithExtractedLineBreaks ...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
@Test public void testEmptyText_mediumWidthAvailable() { List<String> wrappedLines = BasicTextWrapper.wrapMonospaceText(EMPTY_TEXT, MEDIUM_CHARACTERS_AVAILABLE); Assert.assertEquals("", wrappedLines.get(0)); Assert.assertEquals(1, wrappedLines.size()); }
public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithExtractedLineBreaks ...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
@Test public void testSpaceText_mediumWidthAvailable() { List<String> wrappedLines = BasicTextWrapper.wrapMonospaceText(SPACE_TEXT, MEDIUM_CHARACTERS_AVAILABLE); Assert.assertEquals(SPACE_TEXT, wrappedLines.get(0)); Assert.assertEquals(1, wrappedLines.size()); }
public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithExtractedLineBreaks ...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
@Test public void testLongSpaceText_mediumWidthAvailable() { List<String> wrappedLines = BasicTextWrapper.wrapMonospaceText(LONG_SPACE_TEXT, MEDIUM_CHARACTERS_AVAILABLE); Assert.assertEquals(SPACE_TEXT, wrappedLines.get(0)); Assert.assertEquals(1, wrappedLines.size()); }
public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithExtractedLineBreaks ...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
@Test public void testShortText_tinyWidthAvailable() { List<String> wrappedLines = BasicTextWrapper.wrapMonospaceText(SHORT_TEXT, TINY_CHARACTERS_AVAILABLE); Assert.assertEquals("h", wrappedLines.get(0)); Assert.assertEquals("e", wrappedLines.get(1)); Assert.assertEquals("l", wrappedLines.get(2)); Assert.assertEquals("...
public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithExtractedLineBreaks ...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
@Test public void testLongTextWithLongWord_mediumWidthAvailable() { List<String> wrappedLines = BasicTextWrapper.wrapMonospaceText(LONG_TEXT_LONG_WORD, MEDIUM_CHARACTERS_AVAILABLE); Assert.assertEquals(FIRST_LINE, wrappedLines.get(0)); Assert.assertEquals("1", wrappedLines.get(1)); Assert.assertEquals("abcdefghijklmnop...
public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithExtractedLineBreaks ...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
BasicTextWrapper { public static List<String> wrapMonospaceText(String fullText, int charactersAvailable) { Affirm.notNull(fullText); if (charactersAvailable <= 0) { throw new IllegalArgumentException("charactersAvailable needs to be larger than 0, charactersAvailable:" + charactersAvailable); } List<String> linesWithE...
@Test public void testAsInteger() throws Exception { Document document = XpathUtils.documentFrom(DOCUMENT); assertEquals((Integer) 1, XpathUtils.asInteger("Foo/Count", document)); assertEquals(null, XpathUtils.asInteger("Foo/Empty", document)); }
public static Integer asInteger(String expression, Node node) throws XPathExpressionException { String intString = evaluateAsString(expression, node); return (isEmptyString(intString)) ? null : Integer.valueOf(intString); }
XpathUtils { public static Integer asInteger(String expression, Node node) throws XPathExpressionException { String intString = evaluateAsString(expression, node); return (isEmptyString(intString)) ? null : Integer.valueOf(intString); } }
XpathUtils { public static Integer asInteger(String expression, Node node) throws XPathExpressionException { String intString = evaluateAsString(expression, node); return (isEmptyString(intString)) ? null : Integer.valueOf(intString); } }
XpathUtils { public static Integer asInteger(String expression, Node node) throws XPathExpressionException { String intString = evaluateAsString(expression, node); return (isEmptyString(intString)) ? null : Integer.valueOf(intString); } static Document documentFrom(InputStream is); static Document documentFrom(String ...
XpathUtils { public static Integer asInteger(String expression, Node node) throws XPathExpressionException { String intString = evaluateAsString(expression, node); return (isEmptyString(intString)) ? null : Integer.valueOf(intString); } static Document documentFrom(InputStream is); static Document documentFrom(String ...
@Test public void testAsBoolean() throws Exception { Document document = XpathUtils.documentFrom(DOCUMENT); assertEquals(true, XpathUtils.asBoolean("Foo/Enabled", document)); assertEquals(null, XpathUtils.asBoolean("Foo/Empty", document)); }
public static Boolean asBoolean(String expression, Node node) throws XPathExpressionException { String booleanString = evaluateAsString(expression, node); return (isEmptyString(booleanString)) ? null : Boolean.valueOf(booleanString); }
XpathUtils { public static Boolean asBoolean(String expression, Node node) throws XPathExpressionException { String booleanString = evaluateAsString(expression, node); return (isEmptyString(booleanString)) ? null : Boolean.valueOf(booleanString); } }
XpathUtils { public static Boolean asBoolean(String expression, Node node) throws XPathExpressionException { String booleanString = evaluateAsString(expression, node); return (isEmptyString(booleanString)) ? null : Boolean.valueOf(booleanString); } }
XpathUtils { public static Boolean asBoolean(String expression, Node node) throws XPathExpressionException { String booleanString = evaluateAsString(expression, node); return (isEmptyString(booleanString)) ? null : Boolean.valueOf(booleanString); } static Document documentFrom(InputStream is); static Document document...
XpathUtils { public static Boolean asBoolean(String expression, Node node) throws XPathExpressionException { String booleanString = evaluateAsString(expression, node); return (isEmptyString(booleanString)) ? null : Boolean.valueOf(booleanString); } static Document documentFrom(InputStream is); static Document document...
@Test public void testAsFloat() throws Exception { Document document = XpathUtils.documentFrom(DOCUMENT); assertEquals((Float) 0.0000071759f, XpathUtils.asFloat("Foo/Usage", document)); assertEquals(null, XpathUtils.asFloat("Foo/Empty", document)); }
public static Float asFloat(String expression, Node node) throws XPathExpressionException { String floatString = evaluateAsString(expression, node); return (isEmptyString(floatString)) ? null : Float.valueOf(floatString); }
XpathUtils { public static Float asFloat(String expression, Node node) throws XPathExpressionException { String floatString = evaluateAsString(expression, node); return (isEmptyString(floatString)) ? null : Float.valueOf(floatString); } }
XpathUtils { public static Float asFloat(String expression, Node node) throws XPathExpressionException { String floatString = evaluateAsString(expression, node); return (isEmptyString(floatString)) ? null : Float.valueOf(floatString); } }
XpathUtils { public static Float asFloat(String expression, Node node) throws XPathExpressionException { String floatString = evaluateAsString(expression, node); return (isEmptyString(floatString)) ? null : Float.valueOf(floatString); } static Document documentFrom(InputStream is); static Document documentFrom(String ...
XpathUtils { public static Float asFloat(String expression, Node node) throws XPathExpressionException { String floatString = evaluateAsString(expression, node); return (isEmptyString(floatString)) ? null : Float.valueOf(floatString); } static Document documentFrom(InputStream is); static Document documentFrom(String ...
@Test public void testAsByte() throws Exception { Document document = XpathUtils.documentFrom(DOCUMENT); assertEquals(new Byte((byte) 123), XpathUtils.asByte("Foo/PositiveByte", document)); assertEquals(new Byte((byte) -99), XpathUtils.asByte("Foo/NegativeByte", document)); assertEquals(null, XpathUtils.asByte("Foo/Emp...
public static Byte asByte(String expression, Node node) throws XPathExpressionException { String byteString = evaluateAsString(expression, node); return (isEmptyString(byteString)) ? null : Byte.valueOf(byteString); }
XpathUtils { public static Byte asByte(String expression, Node node) throws XPathExpressionException { String byteString = evaluateAsString(expression, node); return (isEmptyString(byteString)) ? null : Byte.valueOf(byteString); } }
XpathUtils { public static Byte asByte(String expression, Node node) throws XPathExpressionException { String byteString = evaluateAsString(expression, node); return (isEmptyString(byteString)) ? null : Byte.valueOf(byteString); } }
XpathUtils { public static Byte asByte(String expression, Node node) throws XPathExpressionException { String byteString = evaluateAsString(expression, node); return (isEmptyString(byteString)) ? null : Byte.valueOf(byteString); } static Document documentFrom(InputStream is); static Document documentFrom(String xml); ...
XpathUtils { public static Byte asByte(String expression, Node node) throws XPathExpressionException { String byteString = evaluateAsString(expression, node); return (isEmptyString(byteString)) ? null : Byte.valueOf(byteString); } static Document documentFrom(InputStream is); static Document documentFrom(String xml); ...
@Test public void testAsDate() throws Exception { Calendar expectedDate = new GregorianCalendar(); expectedDate.set(Calendar.YEAR, 2008); expectedDate.set(Calendar.MONTH, Calendar.OCTOBER); expectedDate.set(Calendar.DAY_OF_MONTH, 7); expectedDate.set(Calendar.AM_PM, Calendar.AM); expectedDate.set(Calendar.HOUR, 11); ex...
public static Date asDate(String expression, Node node) throws XPathExpressionException { String dateString = evaluateAsString(expression, node); if (isEmptyString(dateString)) return null; return DateUtils.parseISO8601Date(dateString); }
XpathUtils { public static Date asDate(String expression, Node node) throws XPathExpressionException { String dateString = evaluateAsString(expression, node); if (isEmptyString(dateString)) return null; return DateUtils.parseISO8601Date(dateString); } }
XpathUtils { public static Date asDate(String expression, Node node) throws XPathExpressionException { String dateString = evaluateAsString(expression, node); if (isEmptyString(dateString)) return null; return DateUtils.parseISO8601Date(dateString); } }
XpathUtils { public static Date asDate(String expression, Node node) throws XPathExpressionException { String dateString = evaluateAsString(expression, node); if (isEmptyString(dateString)) return null; return DateUtils.parseISO8601Date(dateString); } static Document documentFrom(InputStream is); static Document docum...
XpathUtils { public static Date asDate(String expression, Node node) throws XPathExpressionException { String dateString = evaluateAsString(expression, node); if (isEmptyString(dateString)) return null; return DateUtils.parseISO8601Date(dateString); } static Document documentFrom(InputStream is); static Document docum...