Skip to content

Commit

Permalink
HSEARCH-3102 Use the default backend for tests related to missing bac…
Browse files Browse the repository at this point in the history
…kend type
  • Loading branch information
yrodiere committed Jul 13, 2020
1 parent 9da99d7 commit ad19ee7
Showing 1 changed file with 12 additions and 12 deletions.
Expand Up @@ -346,23 +346,23 @@ public void error_missingBackendType_nullType() {
resetAll();

resetAll();
EasyMock.expect( configurationSourceMock.get( "backends.backendName.type" ) )
EasyMock.expect( configurationSourceMock.get( "backend.type" ) )
.andReturn( Optional.empty() );
EasyMock.expect( configurationSourceMock.resolve( "backends.backendName.type" ) )
.andReturn( Optional.of( keyPrefix + "backends.backendName.type" ) );
EasyMock.expect( configurationSourceMock.resolve( "backend.type" ) )
.andReturn( Optional.of( keyPrefix + "backend.type" ) );
EasyMock.expect( rootBuildContextMock.getFailureCollector() )
.andReturn( rootFailureCollectorMock );
EasyMock.expect( rootFailureCollectorMock.withContext( EventContexts.fromBackendName( "backendName" ) ) )
EasyMock.expect( rootFailureCollectorMock.withContext( EventContexts.defaultBackend() ) )
.andReturn( backendFailureCollectorMock );
backendFailureCollectorMock.add( EasyMock.capture( throwableCapture ) );
replayAll();
holder.createBackends( CollectionHelper.asSet( Optional.of( "backendName" ) ) );
holder.createBackends( CollectionHelper.asSet( Optional.empty() ) );
verifyAll();

assertThat( throwableCapture.getValue() )
.isInstanceOf( SearchException.class )
.hasMessageContaining( "Missing backend type" )
.hasMessageContaining( "Set the property 'somePrefix.backends.backendName.type' to a supported value" );
.hasMessageContaining( "Set the property 'somePrefix.backend.type' to a supported value" );
}

@Test
Expand All @@ -383,23 +383,23 @@ public void error_missingBackendType_emptyType() {
resetAll();

resetAll();
EasyMock.expect( configurationSourceMock.get( "backends.backendName.type" ) )
EasyMock.expect( configurationSourceMock.get( "backend.type" ) )
.andReturn( (Optional) Optional.of( "" ) );
EasyMock.expect( configurationSourceMock.resolve( "backends.backendName.type" ) )
.andReturn( Optional.of( keyPrefix + "backends.backendName.type" ) );
EasyMock.expect( configurationSourceMock.resolve( "backend.type" ) )
.andReturn( Optional.of( keyPrefix + "backend.type" ) );
EasyMock.expect( rootBuildContextMock.getFailureCollector() )
.andReturn( rootFailureCollectorMock );
EasyMock.expect( rootFailureCollectorMock.withContext( EventContexts.fromBackendName( "backendName" ) ) )
EasyMock.expect( rootFailureCollectorMock.withContext( EventContexts.defaultBackend() ) )
.andReturn( backendFailureCollectorMock );
backendFailureCollectorMock.add( EasyMock.capture( throwableCapture ) );
replayAll();
holder.createBackends( CollectionHelper.asSet( Optional.of( "backendName" ) ) );
holder.createBackends( CollectionHelper.asSet( Optional.empty() ) );
verifyAll();

assertThat( throwableCapture.getValue() )
.isInstanceOf( SearchException.class )
.hasMessageContaining( "Missing backend type" )
.hasMessageContaining( "Set the property 'somePrefix.backends.backendName.type' to a supported value" );
.hasMessageContaining( "Set the property 'somePrefix.backend.type' to a supported value" );
}

}

0 comments on commit ad19ee7

Please sign in to comment.