LeakAwareDataBufferFactoryTests.java (spring-framework-5.3.23) | : | LeakAwareDataBufferFactoryTests.java (spring-framework-5.3.24) | ||
---|---|---|---|---|
/* | /* | |||
* Copyright 2002-2019 the original author or authors. | * Copyright 2002-2022 the original author or authors. | |||
* | * | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | * You may obtain a copy of the License at | |||
* | * | |||
* https://www.apache.org/licenses/LICENSE-2.0 | * https://www.apache.org/licenses/LICENSE-2.0 | |||
* | * | |||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
skipping to change at line 37 | skipping to change at line 37 | |||
* @author Arjen Poutsma | * @author Arjen Poutsma | |||
*/ | */ | |||
class LeakAwareDataBufferFactoryTests { | class LeakAwareDataBufferFactoryTests { | |||
private final LeakAwareDataBufferFactory bufferFactory = new LeakAwareDat aBufferFactory(); | private final LeakAwareDataBufferFactory bufferFactory = new LeakAwareDat aBufferFactory(); | |||
@Test | @Test | |||
void leak() { | void leak() { | |||
DataBuffer dataBuffer = this.bufferFactory.allocateBuffer(); | DataBuffer dataBuffer = this.bufferFactory.allocateBuffer(); | |||
try { | try { | |||
assertThatExceptionOfType(AssertionError.class).isThrownB | assertThatExceptionOfType(AssertionError.class).isThrownB | |||
y( | y(this.bufferFactory::checkForLeaks); | |||
this.bufferFactory::checkForLeaks); | ||||
} | } | |||
finally { | finally { | |||
release(dataBuffer); | release(dataBuffer); | |||
} | } | |||
} | } | |||
@Test | @Test | |||
void noLeak() { | void noLeak() { | |||
DataBuffer dataBuffer = this.bufferFactory.allocateBuffer(); | DataBuffer dataBuffer = this.bufferFactory.allocateBuffer(); | |||
release(dataBuffer); | release(dataBuffer); | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 3 lines changed or added |