Skip to content

Commit

Permalink
Make it compile with assertj-core:2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
maccluca authored and croesch committed Nov 15, 2017
1 parent 3d5f46a commit e90b7ab
Show file tree
Hide file tree
Showing 31 changed files with 68 additions and 70 deletions.
2 changes: 1 addition & 1 deletion assertj-swing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>2.2.0</version>
<version>2.8.0</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import static java.util.Collections.enumeration;
import static org.assertj.core.util.Lists.newArrayList;
import static org.assertj.core.util.Maps.newHashMap;
import static org.assertj.core.util.Preconditions.checkNotNull;

import java.applet.Applet;
Expand All @@ -24,6 +23,7 @@
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

Expand Down Expand Up @@ -54,7 +54,7 @@ public boolean hasMoreElements() {
}
}

private final Map<String, InputStream> streamMap = newHashMap();
private final Map<String, InputStream> streamMap = new HashMap<>();
private final StatusDisplay statusDisplay;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
*/
package org.assertj.swing.applet;

import static org.assertj.core.util.Maps.newHashMap;
import static org.assertj.core.util.Preconditions.checkNotNull;

import java.applet.AppletContext;
import java.applet.AppletStub;
import java.awt.Window;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nonnull;
Expand All @@ -33,7 +33,7 @@
public class BasicAppletStub implements AppletStub {
private final Window viewer;
private final AppletContext context;
private final Map<String, String> parameters = newHashMap();
private final Map<String, String> parameters = new HashMap<>();

/**
* Creates a new {@link BasicAppletStub}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import static javax.swing.JOptionPane.PLAIN_MESSAGE;
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
import static org.assertj.core.util.Maps.newHashMap;
import static org.assertj.core.util.Preconditions.checkNotNullOrEmpty;
import static org.assertj.core.util.Strings.concat;
import static org.assertj.swing.exception.ActionFailedException.actionFailure;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nonnull;
Expand All @@ -32,7 +32,7 @@
* @author Alex Ruiz
*/
final class JOptionPaneMessageTypes {
private static final Map<Integer, String> messageMap = newHashMap();
private static final Map<Integer, String> messageMap = new HashMap<>();
static {
messageMap.put(ERROR_MESSAGE, "Error Message");
messageMap.put(INFORMATION_MESSAGE, "Information Message");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

import static java.awt.Adjustable.HORIZONTAL;
import static java.awt.Adjustable.VERTICAL;
import static org.assertj.core.util.Maps.newHashMap;
import static org.assertj.core.util.Preconditions.checkNotNull;

import java.awt.Point;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nonnull;
Expand All @@ -36,7 +36,7 @@ public final class JScrollBarLocation {

private static final int BLOCK_OFFSET = 4;

private static final Map<Integer, JScrollBarLocationStrategy> LOCATIONS = newHashMap();
private static final Map<Integer, JScrollBarLocationStrategy> LOCATIONS = new HashMap<>();

static {
LOCATIONS.put(HORIZONTAL, new HorizontalJScrollBarLocation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

import static javax.swing.SwingConstants.HORIZONTAL;
import static javax.swing.SwingConstants.VERTICAL;
import static org.assertj.core.util.Maps.newHashMap;
import static org.assertj.core.util.Preconditions.checkNotNull;

import java.awt.Insets;
import java.awt.Point;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nonnull;
Expand All @@ -33,7 +33,7 @@
* @author Yvonne Wang
*/
public final class JSliderLocation {
private static final Map<Integer, JSliderLocationStrategy> LOCATIONS = newHashMap();
private static final Map<Integer, JSliderLocationStrategy> LOCATIONS = new HashMap<>();

static {
LOCATIONS.put(HORIZONTAL, new JSliderHorizontalLocation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
import static java.lang.Math.min;
import static javax.swing.JSplitPane.HORIZONTAL_SPLIT;
import static javax.swing.JSplitPane.VERTICAL_SPLIT;
import static org.assertj.core.util.Maps.newHashMap;
import static org.assertj.core.util.Preconditions.checkNotNull;
import static org.assertj.swing.edt.GuiActionRunner.execute;

import java.awt.Component;
import java.awt.Insets;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nonnull;
Expand All @@ -39,7 +39,7 @@
* @author Alex Ruiz
*/
final class JSplitPaneLocationCalculator {
private static Map<Integer, LocationFinder> FINDERS = newHashMap();
private static Map<Integer, LocationFinder> FINDERS = new HashMap<>();

static {
add(new VerticalOrientationLocationFinder(), new HorizontalOrientationLocationFinder());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import static javax.swing.SwingUtilities.invokeLater;
import static javax.swing.SwingUtilities.isEventDispatchThread;
import static org.assertj.core.util.Throwables.appendStackTraceInCurentThreadToThrowable;
import static org.assertj.core.util.Throwables.appendStackTraceInCurrentThreadToThrowable;
import static org.assertj.swing.exception.UnexpectedException.unexpected;

import java.util.concurrent.CountDownLatch;
Expand Down Expand Up @@ -146,7 +146,7 @@ private static void rethrowCaughtExceptionIn(@Nonnull GuiAction action) {
return;
}
if (caughtException instanceof RuntimeException) {
appendStackTraceInCurentThreadToThrowable(caughtException, "execute");
appendStackTraceInCurrentThreadToThrowable(caughtException, "execute");
throw (RuntimeException) caughtException;
}
if (caughtException instanceof Error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
*/
package org.assertj.swing.format;

import static org.assertj.core.util.Maps.newConcurrentHashMap;
import static org.assertj.core.util.Preconditions.checkNotNull;
import static org.assertj.core.util.Strings.isNullOrEmpty;
import static org.assertj.swing.edt.GuiActionRunner.execute;

import java.awt.Component;
import java.awt.Dialog;
import java.awt.Frame;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.logging.Logger;

Expand Down Expand Up @@ -66,7 +66,7 @@ public class Formatting {
private static final String VALUE = "value";
private static final String VISIBLE = "visible";

private static final ConcurrentMap<Class<?>, ComponentFormatter> FORMATTERS = newConcurrentHashMap();
private static final ConcurrentMap<Class<?>, ComponentFormatter> FORMATTERS = new ConcurrentHashMap<>();

private static Logger logger = Logger.getLogger(Formatting.class.getCanonicalName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
package org.assertj.swing.format;

import static java.lang.String.valueOf;
import static org.assertj.core.util.Maps.newHashMap;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nonnull;
Expand All @@ -26,7 +26,7 @@
* @author Alex Ruiz
*/
final class IntEnum {
private final Map<Integer, String> map = newHashMap();
private final Map<Integer, String> map = new HashMap<>();

@Nullable
String get(int key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package org.assertj.swing.format;

import static org.assertj.core.util.Lists.newArrayList;
import static org.assertj.core.util.Maps.newHashMap;
import static org.assertj.core.util.Preconditions.checkNotNull;
import static org.assertj.core.util.Strings.concat;
import static org.assertj.core.util.Strings.quote;
Expand All @@ -23,6 +22,7 @@
import java.beans.BeanInfo;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand All @@ -44,7 +44,7 @@ public final class IntrospectionComponentFormatter extends ComponentFormatterTem
private final Class<? extends Component> targetType;
private final List<String> propertyNames;

private final Map<String, PropertyDescriptor> descriptors = newHashMap();
private final Map<String, PropertyDescriptor> descriptors = new HashMap<>();

/**
* Creates a new {@link IntrospectionComponentFormatter}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
*/
package org.assertj.swing.hierarchy;

import static org.assertj.core.util.Maps.newWeakHashMap;
import static org.assertj.swing.awt.AWT.isSharedInvisibleFrame;

import java.awt.Component;
import java.awt.Window;
import java.util.Collection;
import java.util.Map;
import java.util.WeakHashMap;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
Expand All @@ -44,10 +44,10 @@ class WindowFilter {
}

// Map of components to ignore
final Map<Component, Boolean> ignored = newWeakHashMap();
final Map<Component, Boolean> ignored = new WeakHashMap<>();

// Map of components implicitly ignored; these will be removed if they are re-shown.
final Map<Component, Boolean> implicitlyIgnored = newWeakHashMap();
final Map<Component, Boolean> implicitlyIgnored = new WeakHashMap<>();

boolean isImplicitlyIgnored(@Nonnull Component c) {
return implicitlyIgnored.containsKey(c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@

import static java.awt.event.WindowEvent.WINDOW_CLOSED;
import static java.awt.event.WindowEvent.WINDOW_CLOSING;
import static org.assertj.core.util.Maps.newWeakHashMap;

import java.awt.AWTEvent;
import java.awt.Window;
import java.awt.event.WindowEvent;
import java.util.Map;
import java.util.WeakHashMap;

/**
* Verifies that a notification of the disposal of an AWT or Swing {@code Window} is not duplicated.
*
* @author Alex Ruiz
*/
class DisposedWindowMonitor {
final Map<Window, Boolean> disposedWindows = newWeakHashMap();
final Map<Window, Boolean> disposedWindows = new WeakHashMap<>();

// We want to ignore consecutive event indicating window disposal; it needs to be an intervening SHOWN/OPEN before
// we're interested again.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
*/
package org.assertj.swing.keystroke;

import static org.assertj.core.util.Maps.newHashMap;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nonnull;
Expand All @@ -26,8 +25,8 @@
* @author Alex Ruiz
*/
class KeyStrokeMapCollection {
private final Map<Character, KeyStroke> charToKeyStroke = newHashMap();
private final Map<KeyStroke, Character> keyStrokeToChar = newHashMap();
private final Map<Character, KeyStroke> charToKeyStroke = new HashMap<>();
private final Map<KeyStroke, Character> keyStrokeToChar = new HashMap<>();

void add(@Nonnull Character character, @Nonnull KeyStroke keyStroke) {
charToKeyStroke.put(character, keyStroke);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.util.Closeables.closeQuietly;
import static org.assertj.core.util.Lists.newArrayList;
import static org.assertj.core.util.Maps.newHashMap;
import static org.assertj.core.util.Preconditions.checkNotNull;
import static org.assertj.core.util.Preconditions.checkNotNullOrEmpty;
import static org.assertj.core.util.Strings.concat;
Expand All @@ -34,6 +33,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -96,7 +96,7 @@
* @author Alex Ruiz
*/
public class KeyStrokeMappingsParser {
private static final Map<String, Character> SPECIAL_MAPPINGS = newHashMap();
private static final Map<String, Character> SPECIAL_MAPPINGS = new HashMap<>();

static {
SPECIAL_MAPPINGS.put("COMMA", ',');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
*/
package org.assertj.swing.launcher;

import static org.assertj.core.util.Maps.newHashMap;
import static org.assertj.core.util.Preconditions.checkNotNull;
import static org.assertj.core.util.Preconditions.checkNotNullOrEmpty;
import static org.assertj.swing.edt.GuiActionRunner.execute;
import static org.assertj.swing.launcher.NewAppletViewerQuery.showAppletViewerWith;

import java.applet.Applet;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nonnull;
Expand Down Expand Up @@ -81,7 +81,7 @@
*/
public class AppletLauncher {
private final Applet applet;
private final Map<String, String> parameters = newHashMap();
private final Map<String, String> parameters = new HashMap<>();

/**
* Creates a new {@link AppletLauncher}. The {@code Applet} to launch is a new instance of the given type. It is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
package org.assertj.swing.monitor;

import static org.assertj.core.util.Maps.newWeakHashMap;
import static org.assertj.core.util.Sets.newHashSet;

import java.awt.Component;
Expand All @@ -21,6 +20,7 @@
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
Expand All @@ -34,7 +34,7 @@
* @author Alex Ruiz
*/
class EventQueueMapping {
final Map<Component, WeakReference<EventQueue>> queueMap = newWeakHashMap();
final Map<Component, WeakReference<EventQueue>> queueMap = new WeakHashMap<>();

@RunsInCurrentThread
void addQueueFor(@Nonnull Component c) {
Expand Down
Loading

0 comments on commit e90b7ab

Please sign in to comment.