### Question:
AffinityLock implements Closeable { public boolean resetAffinity() { return resetAffinity; } AffinityLock(int cpuId, boolean base, boolean reservable, LockInventory lockInventory); static void cpuLayout(@NotNull CpuLayout cpuLayout); @NotNull static CpuLayout cpuLayout(); static AffinityLock acquireLock(); static AffinityLock acquireCore(); static AffinityLock acquireLock(boolean bind); static AffinityLock acquireLock(int cpuId); static AffinityLock acquireLockLastMinus(int n); static AffinityLock acquireLock(String desc); static AffinityLock acquireCore(boolean bind); @NotNull static String dumpLocks(); boolean resetAffinity(); AffinityLock resetAffinity(boolean resetAffinity); void bind(); void bind(boolean wholeCore); AffinityLock acquireLock(AffinityStrategy... strategies); void release(); @Override void close(); int cpuId(); boolean isAllocated(); boolean isBound(); @Override String toString(); static final String AFFINITY_RESERVED; static final int PROCESSORS; static final BitSet BASE_AFFINITY; static final BitSet RESERVED_AFFINITY; }### Answer:
@Test public void resetAffinity() { assertTrue(Affinity.getAffinity().cardinality() > 1); try (AffinityLock lock = AffinityLock.acquireLock()) { assertEquals(1, Affinity.getAffinity().cardinality()); assertTrue(lock.resetAffinity()); lock.resetAffinity(false); } assertEquals(1, Affinity.getAffinity().cardinality()); try (AffinityLock lock = AffinityLock.acquireLock()) { } assertTrue(Affinity.getAffinity().cardinality() > 1); }