Polishing
This commit is contained in:
@@ -619,9 +619,9 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
private Reference<K, V>[] createReferenceArray(int size) {
|
||||
return (Reference<K, V>[]) Array.newInstance(Reference.class, size);
|
||||
return new Reference[size];
|
||||
}
|
||||
|
||||
private int getIndex(int hash, Reference<K, V>[] references) {
|
||||
@@ -756,8 +756,8 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
|
||||
/**
|
||||
* Execute the task.
|
||||
* @param ref the found reference or {@code null}
|
||||
* @param entry the found entry or {@code null}
|
||||
* @param ref the found reference (or {@code null})
|
||||
* @param entry the found entry (or {@code null})
|
||||
* @param entries access to the underlying entries
|
||||
* @return the result of the task
|
||||
* @see #execute(Reference, Entry)
|
||||
@@ -768,8 +768,8 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V> implemen
|
||||
|
||||
/**
|
||||
* Convenience method that can be used for tasks that do not need access to {@link Entries}.
|
||||
* @param ref the found reference or {@code null}
|
||||
* @param entry the found entry or {@code null}
|
||||
* @param ref the found reference (or {@code null})
|
||||
* @param entry the found entry (or {@code null})
|
||||
* @return the result of the task
|
||||
* @see #execute(Reference, Entry, Entries)
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,41 +23,48 @@ import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
public class OrderUtilsTests {
|
||||
|
||||
@Test
|
||||
public void getSimpleOrder() {
|
||||
assertEquals(Integer.valueOf(50), OrderUtils.getOrder(SimpleOrder.class, null));
|
||||
assertEquals(Integer.valueOf(50), OrderUtils.getOrder(SimpleOrder.class, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPriorityOrder() {
|
||||
assertEquals(Integer.valueOf(55), OrderUtils.getOrder(SimplePriority.class, null));
|
||||
assertEquals(Integer.valueOf(55), OrderUtils.getOrder(SimplePriority.class, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getOrderWithBoth() {
|
||||
assertEquals(Integer.valueOf(50), OrderUtils.getOrder(OrderAndPriority.class, null));
|
||||
assertEquals(Integer.valueOf(50), OrderUtils.getOrder(OrderAndPriority.class, null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDefaultOrder() {
|
||||
assertEquals(Integer.valueOf(33), OrderUtils.getOrder(NoOrder.class, 33));
|
||||
assertEquals(Integer.valueOf(33), OrderUtils.getOrder(NoOrder.class, 33));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPriorityValueNoAnnotation() {
|
||||
assertNull(OrderUtils.getPriority(SimpleOrder.class));
|
||||
assertNull(OrderUtils.getPriority(SimpleOrder.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPriorityValue() {
|
||||
assertEquals(Integer.valueOf(55), OrderUtils.getPriority(OrderAndPriority.class));
|
||||
assertEquals(Integer.valueOf(55), OrderUtils.getPriority(OrderAndPriority.class));
|
||||
}
|
||||
|
||||
|
||||
@Order(50)
|
||||
private static class SimpleOrder {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user