From a90636dca1ed655894710155514173d74ab3fe7e Mon Sep 17 00:00:00 2001 From: Vladimir Dmitrienko Date: Tue, 6 Aug 2024 23:25:54 +0300 Subject: [PATCH] Add 'LockTests'. Issue: #2677 --- .../engine/support/descriptor/LockTests.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/LockTests.java diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/LockTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/LockTests.java new file mode 100644 index 000000000000..fd85f1950ea7 --- /dev/null +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/LockTests.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.engine.support.descriptor; + +import static org.junit.jupiter.api.parallel.ResourceLocksProvider.Lock; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.ResourceAccessMode; +import org.junit.platform.AbstractEqualsAndHashCodeTests; + +/** + * @since 5.12 + */ +class LockTests extends AbstractEqualsAndHashCodeTests { + + @Test + void equalsAndHashCode() { + assertEqualsAndHashCode(new Lock("a"), new Lock("a"), new Lock("b")); + // @formatter:off + assertEqualsAndHashCode( + new Lock("a", ResourceAccessMode.READ_WRITE), + new Lock("a", ResourceAccessMode.READ_WRITE), + new Lock("a", ResourceAccessMode.READ) + ); + // @formatter:on + } +}