@Test public void should_return_getBusinessObjectModel_return_null_when_no_bdm() throws Exception { // given doReturn(false).when(businessDataModelRepository).isDBMDeployed(); // when then assertThat(businessDataModelRepository.getBusinessObjectModel()).isNull(); }
@Test(expected = SBusinessDataRepositoryException.class) public void should_getBusinessObjectModel_throw_exception() throws Exception { // given final InputStream resourceAsStream = this.getClass().getResourceAsStream("client-bdm.zip"); final byte[] clientBDMZip = IOUtil.getAllContentFrom(resourceAsStream); doReturn(true).when(businessDataModelRepository).isDBMDeployed(); doReturn(clientBDMZip).when(businessDataModelRepository).getClientBDMZip(); doThrow(IOException.class) .when(businessDataModelRepository) .getBusinessObjectModel(any(clientBDMZip.getClass())); // when then exception businessDataModelRepository.getBusinessObjectModel(); }
@Test public void should_return_getBusinessObjectModel_return_bdm() throws Exception { // given final InputStream resourceAsStream = this.getClass().getResourceAsStream("client-bdm.zip"); final byte[] clientBDMZip = IOUtil.getAllContentFrom(resourceAsStream); doReturn(true).when(businessDataModelRepository).isDBMDeployed(); doReturn(clientBDMZip).when(businessDataModelRepository).getClientBDMZip(); // when final BusinessObjectModel model = businessDataModelRepository.getBusinessObjectModel(); // then assertThat(model) .as("should return the business model") .as("should return the bom") .isNotNull(); }