Пример #1
0
  @SuppressWarnings({"deprecation"})
  @Before
  public void before() throws Exception {
    EhourHomeUtil.setEhourHome("src/test/resources");
    configService =
        createMock(
            ConfigurationServiceImpl.class,
            ConfigurationServiceImpl.class.getMethod("getConfiguration"),
            ConfigurationServiceImpl.class.getMethod("persistConfiguration", EhourConfig.class));
    getMockContext().putBean("configService", configService);

    mailService = createMock(MailService.class);
    getMockContext().putBean("mailService", mailService);

    config = new EhourConfigStub();
    expect(configService.getConfiguration()).andReturn(config);
  }
Пример #2
0
  @Before
  public void before() throws Exception {
    EhourHomeUtil.setEhourHome("src/test/resources");

    config = new EhourConfigStub();

    when(configService.getConfiguration()).thenReturn(config);
    getMockContext().putBean("configService", configService);

    SystemInfoService infoService = mock(SystemInfoService.class);
    getMockContext().putBean(infoService);
    when(infoService.info()).thenReturn(new SystemInfo("a", "b", "c"));

    getMockContext().putBean("mailMan", mailMan);
    getMockContext().putBean("userService", userService);
    getMockContext().putBean("configurationPersistence", iPersistConfiguration);
  }