BasicConfiguration { public boolean hasBasePackages() { return servletContext.getInitParameter(BasicConfiguration.BASE_PACKAGES_PARAMETER_NAME) != null; } BasicConfiguration(ServletContext servletContext); ContainerProvider getProvider(); boolean hasBasePackages(); String[] getBasePackages(); String getEncoding(); String getWebinfClassesDirectory(); ServletContext getServletContext(); boolean isClasspathScanningEnabled(); static final String CONTAINER_PROVIDER; static final String ENCODING; static final String BASE_PACKAGES_PARAMETER_NAME; static final String SCANNING_PARAM; }
@Test public void shouldReturnThatHasNoBasePackageWhenInitParamNull() throws ServletException { when(context.getInitParameter(BasicConfiguration.BASE_PACKAGES_PARAMETER_NAME)).thenReturn(null); assertThat(config.hasBasePackages(), is(false)); }
@Test public void testIfHasBasePackages() { when(context.getInitParameter(BasicConfiguration.BASE_PACKAGES_PARAMETER_NAME)).thenReturn(null, "foo.bar"); assertThat(config.hasBasePackages(), is(false)); assertThat(config.hasBasePackages(), is(true)); }