@Test(expected = MetaDataNotExistsException.class) public void getMetaDataNotExist() throws MetaDataNotExistsException { String idApplication = "9"; // Fixture Mockito.when(metaDataRepository.findOne(idApplication)).thenReturn(null); // Experimentation metaDataManagerImpl.getMetaData(idApplication); // Expectations Mockito.verify(metaDataRepository).findOne(idApplication); }
@Test public void getMetaDataExist() throws MetaDataNotExistsException { String idApplication = "9"; // Fixture Mockito.when(metaDataRepository.findOne(idApplication)).thenReturn(metaData); // Experimentation MetaData response = metaDataManagerImpl.getMetaData(idApplication); // Expectations Mockito.verify(metaDataRepository).findOne(idApplication); Assert.assertEquals("Response must be equals", metaData, response); }