Skip to content

Commit

Permalink
Fix test expecting wrong exception
Browse files Browse the repository at this point in the history
  • Loading branch information
burqen committed Mar 14, 2018
1 parent 4d5ad10 commit c611079
Showing 1 changed file with 6 additions and 6 deletions.
Expand Up @@ -664,18 +664,18 @@ public void readHeaderMustThrowIfFileDoesNotExist() throws Exception
} }


@Test @Test
public void openWithReadHeaderMustThrowIOExceptionIfFileIsEmpty() throws Exception public void openWithReadHeaderMustThrowMetadataMismatchExceptionIfFileIsEmpty() throws Exception
{ {
openMustThrowIOExceptionIfFileIsEmpty( pageCache -> GBPTree.readHeader( pageCache, indexFile, layout, NO_HEADER_READER ) ); openMustThrowMetadataMismatchExceptionIfFileIsEmpty( pageCache -> GBPTree.readHeader( pageCache, indexFile, layout, NO_HEADER_READER ) );
} }


@Test @Test
public void openWithConstructorMustThrowIOExceptionIfFileIsEmpty() throws Exception public void openWithConstructorMustThrowMetadataMismatchExceptionIfFileIsEmpty() throws Exception
{ {
openMustThrowIOExceptionIfFileIsEmpty( pageCache -> index( pageCache ).build() ); openMustThrowMetadataMismatchExceptionIfFileIsEmpty( pageCache -> index( pageCache ).build() );
} }


private void openMustThrowIOExceptionIfFileIsEmpty( ThrowingConsumer<PageCache,IOException> opener ) throws Exception private void openMustThrowMetadataMismatchExceptionIfFileIsEmpty( ThrowingConsumer<PageCache,IOException> opener ) throws Exception
{ {
// given an existing empty file // given an existing empty file
PageCache pageCache = createPageCache( DEFAULT_PAGE_SIZE ); PageCache pageCache = createPageCache( DEFAULT_PAGE_SIZE );
Expand All @@ -687,7 +687,7 @@ private void openMustThrowIOExceptionIfFileIsEmpty( ThrowingConsumer<PageCache,I
opener.accept( pageCache ); opener.accept( pageCache );
fail( "Should've thrown IOException" ); fail( "Should've thrown IOException" );
} }
catch ( IOException e ) catch ( MetadataMismatchException e )
{ {
// then good // then good
} }
Expand Down

0 comments on commit c611079

Please sign in to comment.