### Question:
EditionLocksFactories { public static LocksFactory createLockFactory( Config config, LogService logging ) { String key = config.get( GraphDatabaseSettings.lock_manager ); for ( DynamicLocksFactory candidate : Service.load( DynamicLocksFactory.class ) ) { String candidateId = candidate.getKeys().iterator().next(); if ( key.equals( candidateId ) ) { return candidate; } else if ( "".equals( key ) ) { logging.getInternalLog( CommunityEditionModule.class ) .info( "No locking implementation specified, defaulting to '" + candidateId + "'" ); return candidate; } } if ( "community".equals( key ) ) { return new CommunityLocksFactory(); } else if ( StringUtils.isEmpty( key ) ) { logging.getInternalLog( CommunityEditionModule.class ) .info( "No locking implementation specified, defaulting to 'community'" ); return new CommunityLocksFactory(); } throw new IllegalArgumentException( "No lock manager found with the name '" + key + "'." ); }  static Locks createLockManager( LocksFactory locksFactory, Config config, Clock clock ); static LocksFactory createLockFactory( Config config, LogService logging );  }### Answer:
@Test void createCommunityLocksFactoryWhenNotConfigured() { Config config = Config.defaults(); LocksFactory lockFactory = createLockFactory( config, NullLogService.getInstance() ); assertThat( lockFactory, instanceOf( CommunityLocksFactory.class ) ); }
@Test void createCommunityLocksFactoryWhenSpecified() { Config config = Config.defaults(GraphDatabaseSettings.lock_manager, "community"); LocksFactory lockFactory = createLockFactory( config, NullLogService.getInstance() ); assertThat( lockFactory, instanceOf( CommunityLocksFactory.class ) ); }
@Test void failToCreateWhenConfiguredFactoryNotFound() { Config config = Config.defaults(GraphDatabaseSettings.lock_manager, "notFoundManager"); IllegalArgumentException exception = assertThrows( IllegalArgumentException.class, () -> createLockFactory( config, NullLogService.getInstance() ) ); assertEquals( "No lock manager found with the name 'notFoundManager'.", exception.getMessage() ); }