gemmellr commented on code in PR #5334: URL: https://github.com/apache/activemq-artemis/pull/5334#discussion_r1856877053
########## artemis-server/src/test/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImplTest.java: ########## @@ -0,0 +1,252 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.postoffice.impl; + +import org.apache.activemq.artemis.api.core.Message; +import org.apache.activemq.artemis.core.settings.impl.AddressSettings; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class PostOfficeImplTest { + + private static final int EXPIRATION_DELTA = 5000; + + @Test + public void testZeroMaxExpiryDelayWhenExpirationNotSet() { + Message mockMessage = Mockito.mock(Message.class); + Mockito.when(mockMessage.getExpiration()).thenReturn(0L); + PostOfficeImpl.applyExpiryDelay(mockMessage, new AddressSettings().setMaxExpiryDelay(0L)); + Mockito.verify(mockMessage).setExpiration(Mockito.anyLong()); Review Comment: Another consequence of removing the 'dont set on 0' bit was this test (and testZeroMinExpiryDelayWhenExpirationNotSet further down) is now almost useless. Beforehand the test checked _nothing_ was set (because the value was already as expected), which was a very tight check of the correct value then being in effect. Thats why I didnt originally need to update it along with the other tests to more closely check that an appropriate value being set, as it was already as precise as possible. After the update it is now instead just allowing _any_ value to be set, which is effectively no check at all that the correct value is in effect. At the very least it should check 0 is set if thats whats expected to happen (though as earlier comment, I think you were correct to avoid that and it shouldnt) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For additional commands, e-mail: gitbox-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact