org.jmock.lib.legacy.ClassImposteriser Java Examples
The following examples show how to use
org.jmock.lib.legacy.ClassImposteriser.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SiteExporterImplTest.java From google-sites-liberation with Apache License 2.0 | 6 votes |
@Before public void before() throws MalformedURLException { context = new JUnit4Mockery() {{ setImposteriser(ClassImposteriser.INSTANCE); }}; linkConverter = context.mock(AbsoluteLinkConverter.class); appendableFactory = context.mock(AppendableFactory.class); attachmentDownloader = new FakeDownloader(); entryStore = context.mock(EntryStore.class); entryStoreFactory = context.mock(EntryStoreFactory.class); feedProvider = context.mock(FeedProvider.class); pageExporter = context.mock(PageExporter.class); progressListener = context.mock(ProgressListener.class); revisionsExporter = context.mock(RevisionsExporter.class); siteExporter = new SiteExporterImpl(linkConverter, appendableFactory, attachmentDownloader, entryStoreFactory, feedProvider, pageExporter, revisionsExporter); sitesService = new SitesService(""); entries = Sets.newHashSet(); feedUrl = new URL("https://host/feeds/content/domain/webspace"); }
Example #2
Source File: EntryParserImplTest.java From google-sites-liberation with Apache License 2.0 | 6 votes |
@Before public void before() { context = new JUnit4Mockery() {{ setImposteriser(ClassImposteriser.INSTANCE); }}; authorParser = context.mock(AuthorParser.class); contentParser = context.mock(ContentParser.class); dataParser = context.mock(DataParser.class); fieldParser = context.mock(FieldParser.class); summaryParser = context.mock(SummaryParser.class); titleParser = context.mock(TitleParser.class); updatedParser = context.mock(UpdatedParser.class); entryParser = new EntryParserImpl(authorParser, contentParser, dataParser, fieldParser, summaryParser, titleParser, updatedParser); try { document = DocumentBuilderFactory.newInstance() .newDocumentBuilder().newDocument(); } catch (ParserConfigurationException e) { fail("Failure to create test document"); } }
Example #3
Source File: SystemEntitlementsSetupActionTest.java From uyuni with GNU General Public License v2.0 | 6 votes |
@Override public void setUp() throws Exception { super.setUp(); Config.get().setBoolean(ConfigDefaults.KIWI_OS_IMAGE_BUILDING_ENABLED, "true"); context.setImposteriser(ClassImposteriser.INSTANCE); saltServiceMock = context.mock(SaltService.class); systemEntitlementManager = new SystemEntitlementManager( new SystemUnentitler(new VirtManagerSalt(saltServiceMock), new FormulaMonitoringManager()), new SystemEntitler(saltServiceMock, new VirtManagerSalt(saltServiceMock), new FormulaMonitoringManager()) ); setRequestPathInfo("/systems/SystemEntitlements"); UserTestUtils.addManagement(user.getOrg()); UserTestUtils.addVirtualization(user.getOrg()); }
Example #4
Source File: JobReturnEventMessageActionTest.java From uyuni with GNU General Public License v2.0 | 6 votes |
@Override public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); Config.get().setString("server.secret_key", DigestUtils.sha256Hex(TestUtils.randomString())); saltServiceMock = context().mock(SaltService.class); systemEntitlementManager = new SystemEntitlementManager( new SystemUnentitler(new VirtManagerSalt(saltServiceMock), new FormulaMonitoringManager()), new SystemEntitler(saltServiceMock, new VirtManagerSalt(saltServiceMock), new FormulaMonitoringManager()) ); metadataDirOfficial = Files.createTempDirectory("meta"); FormulaFactory.setMetadataDirOfficial(metadataDirOfficial.toString()); Path systemLockDir = metadataDirOfficial.resolve("system-lock"); Path systemLockFile = Paths.get(systemLockDir.toString(), "form.yml"); Files.createDirectories(systemLockDir); Files.createFile(systemLockFile); }
Example #5
Source File: UnpagedListDisplayTagTest.java From uyuni with GNU General Public License v2.0 | 6 votes |
public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); RhnBaseTestCase.disableLocalizationServiceLogging(); request = mock(HttpServletRequest.class); response = mock(HttpServletResponse.class); context = mock(PageContext.class); writer = new RhnMockJspWriter(); ldt = new UnpagedListDisplayTag(); lt = new ListTag(); ldt.setPageContext(context); ldt.setParent(lt); lt.setPageList(new DataResult(CSVWriterTest.getTestListOfMaps())); context().checking(new Expectations() { { atLeast(1).of(context).getOut(); will(returnValue(writer)); atLeast(1).of(context).getRequest(); will(returnValue(request)); atLeast(1).of(context).setAttribute("current", null); } }); }
Example #6
Source File: ListDisplayTagTest.java From uyuni with GNU General Public License v2.0 | 6 votes |
public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); RhnBaseTestCase.disableLocalizationServiceLogging(); request = mock(HttpServletRequest.class); response = mock(HttpServletResponse.class); pageContext = mock(PageContext.class); writer = new RhnMockJspWriter(); ldt = new ListDisplayTag(); lt = new ListTag(); ldt.setPageContext(pageContext); ldt.setParent(lt); lt.setPageList(new DataResult(CSVWriterTest.getTestListOfMaps())); context().checking(new Expectations() { { atLeast(1).of(pageContext).getOut(); will(returnValue(writer)); atLeast(1).of(pageContext).getRequest(); will(returnValue(request)); atLeast(1).of(pageContext).setAttribute("current", null); } }); }
Example #7
Source File: ListTagTest.java From uyuni with GNU General Public License v2.0 | 6 votes |
public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); RhnBaseTestCase.disableLocalizationServiceLogging(); final List dataList = CSVWriterTest.getTestListOfMaps(); req = mock(HttpServletRequest.class); pageContext = mock(PageContext.class); webSess = mock(WebSession.class); writer = new RhnMockJspWriter(); context().checking(new Expectations() { { atLeast(1).of(pageContext).getAttribute(listName); will(returnValue(dataList)); atLeast(1).of(pageContext).getRequest(); will(returnValue(req)); } }); lt = new ListTag(); lt.setName("testIsMyName"); lst = new ListSetTag(); lt.setPageContext(pageContext); lt.setParent(lst); lt.setDataset(listName); }
Example #8
Source File: SaltServerActionServiceTest.java From uyuni with GNU General Public License v2.0 | 6 votes |
@Override public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); VirtManager virtManager = new TestVirtManager() { @Override public void updateLibvirtEngine(MinionServer minion) { } }; SystemQuery systemQuery = new SaltService() { @Override public Optional<JsonElement> rawJsonCall(LocalCall<?> call, String minionId) { return Optional.of(new JsonObject()); } }; minion = MinionServerFactoryTest.createTestMinionServer(user); saltServerActionService = createSaltServerActionService(systemQuery); systemEntitlementManager = new SystemEntitlementManager( new SystemUnentitler(virtManager, new FormulaMonitoringManager()), new SystemEntitler(systemQuery, virtManager, new FormulaMonitoringManager()) ); sshPushSystemMock = mock(SystemSummary.class); }
Example #9
Source File: EntryUploaderImplTest.java From google-sites-liberation with Apache License 2.0 | 5 votes |
@Before public void before() throws MalformedURLException { context = new JUnit4Mockery() {{ setImposteriser(ClassImposteriser.INSTANCE); }}; sitesService = context.mock(SitesService.class); entryInserter = context.mock(EntryInserter.class); entryProvider = context.mock(EntryProvider.class); entryUpdater = context.mock(EntryUpdater.class); feedUrl = new URL("http://sites.google.com/feeds/content/site/test"); entryUploader = new EntryUploaderImpl(entryInserter, entryProvider, entryUpdater); }
Example #10
Source File: ConfigurationManagerTest.java From uyuni with GNU General Public License v2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); //Create a user and an org user = UserTestUtils.findNewUser("testyman", "orgman"); pc = new PageControl(); pc.setStart(1); pc.setPageSize(20); cm = ConfigurationManager.getInstance(); CONTEXT.setImposteriser(ClassImposteriser.INSTANCE); }
Example #11
Source File: ByteChannelReaderTest.java From nanofix with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { mockery.setImposteriser(ClassImposteriser.INSTANCE); readableByteChannel = mockery.mock(ReadableByteChannel.class); byteStreamMessageParser = mockery.mock(ByteStreamMessageParser.class); connectionObserver = mockery.mock(ConnectionObserver.class); inputStreamReader = new ByteChannelReader(byteStreamMessageParser, new ThreadBlocker(), connectionObserver); }
Example #12
Source File: CSVTagTest.java From uyuni with GNU General Public License v2.0 | 5 votes |
public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); RhnBaseTestCase.disableLocalizationServiceLogging(); req = mock(HttpServletRequest.class); session = mock(HttpSession.class); context = mock(PageContext.class); writer = new RhnMockJspWriter(); csv = new CSVTag(); csv.setName("testIsMyName"); lst = new ListSetTag(); csv.setPageContext(context); csv.setParent(lst); csv.setDataset(listName); context().checking(new Expectations() { { List dataList = CSVWriterTest.getTestListOfMaps(); atLeast(1).of(context).getAttribute(listName); will(returnValue(dataList)); atLeast(1).of(context).getRequest(); will(returnValue(req)); atLeast(1).of(req).getSession(true); will(returnValue(session)); atLeast(1).of(session).setAttribute( with(equal("exportColumns_" + csv.getUniqueName())), with(any(String.class))); atLeast(1).of(session).setAttribute( with(equal("pageList_" + csv.getUniqueName())), with(any(List.class))); } }); }
Example #13
Source File: SampleCollectorJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); new File(dir).mkdir(); this.mockContext = new Mockery() {{ setImposteriser(ClassImposteriser.INSTANCE); }}; LogWriterI18n log = new PureLogWriter(LogWriterImpl.levelNameToCode("config")); final long startTime = System.currentTimeMillis(); this.manager = new TestStatisticsManager( 1, "SampleCollectorJUnitTest", startTime, log); final StatArchiveHandlerConfig mockStatArchiveHandlerConfig = this.mockContext.mock(StatArchiveHandlerConfig.class, "SampleCollectorJUnitTest$StatArchiveHandlerConfig"); this.mockContext.checking(new Expectations() {{ allowing(mockStatArchiveHandlerConfig).getArchiveFileName(); will(returnValue(new File(""))); allowing(mockStatArchiveHandlerConfig).getArchiveFileSizeLimit(); will(returnValue(0)); allowing(mockStatArchiveHandlerConfig).getArchiveDiskSpaceLimit(); will(returnValue(0)); allowing(mockStatArchiveHandlerConfig).getSystemId(); will(returnValue(1)); allowing(mockStatArchiveHandlerConfig).getSystemStartTime(); will(returnValue(startTime)); allowing(mockStatArchiveHandlerConfig).getSystemDirectoryPath(); will(returnValue("")); allowing(mockStatArchiveHandlerConfig).getProductDescription(); will(returnValue("SampleCollectorJUnitTest")); }}); StatisticsSampler sampler = new TestStatisticsSampler(manager); this.sampleCollector = new SampleCollector(sampler); this.sampleCollector.initialize(mockStatArchiveHandlerConfig, NanoTimer.getTime()); }
Example #14
Source File: RegionPathConverterJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
@Before public void setup() { mockContext = new Mockery() { { setImposteriser(ClassImposteriser.INSTANCE); } }; }
Example #15
Source File: SystemManagerTest.java From uyuni with GNU General Public License v2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); Config.get().setString(CobblerXMLRPCHelper.class.getName(), MockXMLRPCInvoker.class.getName()); MockConnection.clear(); setImposteriser(ClassImposteriser.INSTANCE); TaskomaticApi taskomaticMock = mock(TaskomaticApi.class); ActionManager.setTaskomaticApi(taskomaticMock); saltServiceMock = mock(SaltService.class); tmpSaltRoot = Files.createTempDirectory("salt"); metadataDirOfficial = Files.createTempDirectory("meta"); FormulaFactory.setDataDir(tmpSaltRoot.toString()); FormulaFactory.setMetadataDirOfficial(metadataDirOfficial.toString()); SystemManager.mockSaltService(saltServiceMock); context().checking(new Expectations() { { allowing(taskomaticMock) .scheduleActionExecution(with(any(Action.class))); } }); SaltService saltService = new SaltService(); systemEntitlementManager = new SystemEntitlementManager( new SystemUnentitler(new VirtManagerSalt(saltService), new FormulaMonitoringManager()), new SystemEntitler(saltService, new VirtManagerSalt(saltService), new FormulaMonitoringManager()) ); this.systemManager = new SystemManager(ServerFactory.SINGLETON, ServerGroupFactory.SINGLETON); createMetadataFiles(); }
Example #16
Source File: SystemManagerMockTest.java From uyuni with GNU General Public License v2.0 | 5 votes |
@Override protected void setUp() throws Exception { super.setUp(); Config.get().setString(CobblerXMLRPCHelper.class.getName(), MockXMLRPCInvoker.class.getName()); setImposteriser(ClassImposteriser.INSTANCE); MockConnection.clear(); }
Example #17
Source File: ClusterActionCommandTest.java From uyuni with GNU General Public License v2.0 | 5 votes |
public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); taskomaticMock = mock(TaskomaticApi.class); ActionManager.setTaskomaticApi(taskomaticMock); ClusterActionCommand.setTaskomaticApi(taskomaticMock); context().checking(new Expectations() {{ ignoring(taskomaticMock).scheduleActionExecution(with(any(Action.class))); }}); }
Example #18
Source File: MatcherJsonIOTest.java From uyuni with GNU General Public License v2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); VirtManager virtManager = new TestVirtManager() { @Override public void updateLibvirtEngine(MinionServer minion) { } }; systemEntitlementManager = new SystemEntitlementManager( new SystemUnentitler(virtManager, new FormulaMonitoringManager()), new SystemEntitler(new SaltService(), virtManager, new FormulaMonitoringManager()) ); }
Example #19
Source File: KubernetesManagerTest.java From uyuni with GNU General Public License v2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); saltServiceMock = mock(SaltService.class); manager = new KubernetesManager(saltServiceMock); for (VirtualHostManager virtHostMgr : VirtualHostManagerFactory.getInstance().listVirtualHostManagers()) { VirtualHostManagerFactory.getInstance().delete(virtHostMgr); } }
Example #20
Source File: FormulaManagerTest.java From uyuni with GNU General Public License v2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); MockConnection.clear(); saltServiceMock = mock(SaltService.class); manager.setSystemQuery(saltServiceMock); manager.setSaltApi(saltServiceMock); metadataDir = Files.createTempDirectory("metadata"); FormulaFactory.setDataDir(tmpSaltRoot.toString()); FormulaFactory.setMetadataDirOfficial(metadataDir.toString()); createMetadataFiles(); }
Example #21
Source File: StatisticsMonitorJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public void setUp() throws Exception { super.setUp(); this.mockContext = new Mockery() {{ setImposteriser(ClassImposteriser.INSTANCE); }}; this.log = new PureLogWriter(LogWriterImpl.levelNameToCode("config")); final long startTime = System.currentTimeMillis(); this.manager = new TestStatisticsManager( 1, "StatisticsMonitorJUnitTest", startTime, log); final StatArchiveHandlerConfig mockStatArchiveHandlerConfig = this.mockContext.mock(StatArchiveHandlerConfig.class, "StatisticsMonitorJUnitTest$StatArchiveHandlerConfig"); this.mockContext.checking(new Expectations() {{ allowing(mockStatArchiveHandlerConfig).getArchiveFileName(); will(returnValue(new File(""))); allowing(mockStatArchiveHandlerConfig).getArchiveFileSizeLimit(); will(returnValue(0)); allowing(mockStatArchiveHandlerConfig).getArchiveDiskSpaceLimit(); will(returnValue(0)); allowing(mockStatArchiveHandlerConfig).getSystemId(); will(returnValue(1)); allowing(mockStatArchiveHandlerConfig).getSystemStartTime(); will(returnValue(startTime)); allowing(mockStatArchiveHandlerConfig).getSystemDirectoryPath(); will(returnValue("")); allowing(mockStatArchiveHandlerConfig).getProductDescription(); will(returnValue("StatisticsMonitorJUnitTest")); }}); StatisticsSampler sampler = new TestStatisticsSampler(manager); this.sampleCollector = new SampleCollector(sampler); this.sampleCollector.initialize(mockStatArchiveHandlerConfig, NanoTimer.getTime()); }
Example #22
Source File: BaseJUnit4TestFBField.java From jaybird with GNU Lesser General Public License v2.1 | 5 votes |
@Before public void setUp() throws Exception { context.setImposteriser(ClassImposteriser.INSTANCE); fieldData = context.mock(FieldDataProvider.class); rowDescriptorBuilder .setFieldName(ALIAS_VALUE) .setOriginalName(NAME_VALUE) .setOriginalTableName(RELATION_NAME_VALUE); }
Example #23
Source File: BaseControllerTestCase.java From uyuni with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public void setUp() throws Exception { super.setUp(); user.addPermanentRole(RoleFactory.ORG_ADMIN); setImposteriser(ClassImposteriser.INSTANCE); response = RequestResponseFactory.create(new RhnMockHttpServletResponse()); }
Example #24
Source File: TcpTransportTest.java From nanofix with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { mockery = new Mockery(); mockery.setImposteriser(ClassImposteriser.INSTANCE); publishingTransportObserver = mockery.mock(PublishingConnectionObserver.class); serverSocketChannel = mockery.mock(DelegatingServerSocketChannel.class); socketFactory = mockery.mock(SocketFactory.class); socketAddress = new InetSocketAddress("host", 222); }
Example #25
Source File: GuiProgressListenerTest.java From google-sites-liberation with Apache License 2.0 | 5 votes |
@Before public void before() { context = new JUnit4Mockery() {{ setImposteriser(ClassImposteriser.INSTANCE); }}; progressBar = context.mock(JProgressBar.class); textComponent = context.mock(JTextComponent.class); progressListener = new GuiProgressListener(progressBar, textComponent); }
Example #26
Source File: ImageDeployedEventMessageActionTest.java From uyuni with GNU General Public License v2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); saltMock = mock(SaltService.class); taskomaticMock = mock(TaskomaticApi.class); ActionManager.setTaskomaticApi(taskomaticMock); // setup a minion testMinion = MinionServerFactoryTest.createTestMinionServer(user); testMinion.setServerArch(ServerFactory.lookupServerArchByLabel("x86_64-redhat-linux")); grains = getGrains(); // setup channels & product ChannelFamily channelFamily = ErrataTestUtils.createTestChannelFamily(); SUSEProduct product = SUSEProductTestUtils.createTestSUSEProduct(channelFamily); baseChannelX8664 = setupBaseAndRequiredChannels(channelFamily, product); systemQuery = new SaltService() { @Override public Optional<List<Zypper.ProductInfo>> getProducts(String minionId) { List<Zypper.ProductInfo> pil = new ArrayList<>(); Zypper.ProductInfo pi = new Zypper.ProductInfo( product.getName(), product.getArch().getLabel(), "descr", "eol", "epoch", "flavor", true, true, "productline", Optional.of("registerrelease"), "test", "repo", "shortname", "summary", "vendor", product.getVersion()); pil.add(pi); return Optional.of(pil); } }; context().checking(new Expectations() {{ allowing(taskomaticMock).scheduleActionExecution(with(any(Action.class))); }}); }
Example #27
Source File: LibvirtEngineDomainLifecycleMessageActionTest.java From uyuni with GNU General Public License v2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public void setUp() throws Exception { super.setUp(); user.addPermanentRole(RoleFactory.ORG_ADMIN); setImposteriser(ClassImposteriser.INSTANCE); virtManager = new TestVirtManager() { @Override public Optional<Map<String, JsonElement>> getCapabilities(String minionId) { return SaltTestUtils.getSaltResponse( "/com/suse/manager/webui/controllers/test/virt.guest.allcaps.json", null, new TypeToken<Map<String, JsonElement>>() { }); } @Override public void updateLibvirtEngine(MinionServer minion) { assertTrue(minion.getMinionId().startsWith("serverfactorytest")); } @Override public Optional<GuestDefinition> getGuestDefinition(String minionId, String domainName) { return SaltTestUtils.<String>getSaltResponse( "/com/suse/manager/reactor/messaging/test/virt.guest.definition.xml", Collections.emptyMap(), null) .map(xml -> GuestDefinition.parse(xml, Optional.empty())); } }; SystemEntitlementManager systemEntitlementManager = new SystemEntitlementManager( new SystemUnentitler(virtManager, new FormulaMonitoringManager()), new SystemEntitler(new SaltService(), virtManager, new FormulaMonitoringManager()) ); host = ServerTestUtils.createVirtHostWithGuests(user, 1, true, systemEntitlementManager); host.getGuests().iterator().next().setUuid(guid); host.getGuests().iterator().next().setName("sles12sp2"); host.asMinionServer().get().setMinionId("testminion.local"); }
Example #28
Source File: MinionStartupActionTest.java From uyuni with GNU General Public License v2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); MockConnection.clear(); saltServiceMock = mock(SaltService.class); }
Example #29
Source File: SaltSSHServiceTest.java From uyuni with GNU General Public License v2.0 | 5 votes |
@Override public void setUp() throws Exception { super.setUp(); setImposteriser(ClassImposteriser.INSTANCE); Config.get().setString("ssh_push_port_https", "1233"); Config.get().setString("ssh_push_sudo_user", "mgruser"); }
Example #30
Source File: StatisticsMonitorJUnitTest.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public void setUp() throws Exception { super.setUp(); this.mockContext = new Mockery() {{ setImposteriser(ClassImposteriser.INSTANCE); }}; this.log = new PureLogWriter(LogWriterImpl.levelNameToCode("config")); final long startTime = System.currentTimeMillis(); this.manager = new TestStatisticsManager( 1, "StatisticsMonitorJUnitTest", startTime, log); final StatArchiveHandlerConfig mockStatArchiveHandlerConfig = this.mockContext.mock(StatArchiveHandlerConfig.class, "StatisticsMonitorJUnitTest$StatArchiveHandlerConfig"); this.mockContext.checking(new Expectations() {{ allowing(mockStatArchiveHandlerConfig).getArchiveFileName(); will(returnValue(new File(""))); allowing(mockStatArchiveHandlerConfig).getArchiveFileSizeLimit(); will(returnValue(0)); allowing(mockStatArchiveHandlerConfig).getArchiveDiskSpaceLimit(); will(returnValue(0)); allowing(mockStatArchiveHandlerConfig).getSystemId(); will(returnValue(1)); allowing(mockStatArchiveHandlerConfig).getSystemStartTime(); will(returnValue(startTime)); allowing(mockStatArchiveHandlerConfig).getSystemDirectoryPath(); will(returnValue("")); allowing(mockStatArchiveHandlerConfig).getProductDescription(); will(returnValue("StatisticsMonitorJUnitTest")); }}); StatisticsSampler sampler = new TestStatisticsSampler(manager); this.sampleCollector = new SampleCollector(sampler); this.sampleCollector.initialize(mockStatArchiveHandlerConfig, NanoTimer.getTime()); }