使用真实服务运行JUnit测试

时间:2018-01-23 17:17:23

标签: spring service junit autowired

我有一个外部系统,我可以访问指定URL,用户名和密码到我通过XML文件与我的应用程序匹配的属性文件

<util:properties id="applicationProperties"
        location="classpath:application-resources/my-properties.properties" />

这是我的服务

public class RSDSIntegrationServiceImpl implements RSDSIntegrationService {

private static final Log log = Log.getLog( RSDSIntergrationServiceImpl.class );

@Value("${rsds.filestore.workspace}")
private String workspace;

@Autowired
@Qualifier( "oiaNetworkFileStore" )
private IStoreAccess storeAccess;

@Override
public String storeFile(InputStream inputStream, String applicationID) {
    log.info( "Storing file in RSDS for the Online Instalment Arrangement application with ID: " + applicationID );
    return storeAccess.store( workspace , inputStream );
}

我想运行一个JUnit测试来测试storeFile方法是否会将我的文件存储到这个外部系统中。

@RunWith( SpringJUnit4ClassRunner.class )    
@ContextConfiguration( locations="htb-config/oia-test-context.xml" )    
public class RSDSIntegrationServiceTest {

@Autowired
    private RSDSIntegrationService rsdsIntegrationService;

@Test

    public void connectivityTest() {
        Assert.assertNotNull( rsdsIntegrationService );
    }

为什么断言失败?我错过了什么?

感谢所有......

0 个答案:

没有答案