Make consistent use of the diamond operator with generic types

This commit is contained in:
Andy Wilkinson
2016-01-26 11:14:29 +00:00
parent 08b24e0496
commit 02fa42445f
16 changed files with 45 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2016 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.
@@ -174,7 +174,7 @@ public class LinksSnippetTests {
private static class StubLinkExtractor implements LinkExtractor {
private MultiValueMap<String, Link> linksByRel = new LinkedMultiValueMap<String, Link>();
private MultiValueMap<String, Link> linksByRel = new LinkedMultiValueMap<>();
@Override
public MultiValueMap<String, Link> extractLinks(OperationResponse response)

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2016 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.
@@ -138,22 +138,22 @@ public class JsonFieldProcessorTests {
@Test(expected = FieldDoesNotExistException.class)
public void nonExistentNestedField() {
HashMap<String, Object> payload = new HashMap<String, Object>();
HashMap<String, Object> payload = new HashMap<>();
payload.put("a", new HashMap<String, Object>());
this.fieldProcessor.extract(JsonFieldPath.compile("a.b"), payload);
}
@Test(expected = FieldDoesNotExistException.class)
public void nonExistentNestedFieldWhenParentIsNotAMap() {
HashMap<String, Object> payload = new HashMap<String, Object>();
HashMap<String, Object> payload = new HashMap<>();
payload.put("a", 5);
this.fieldProcessor.extract(JsonFieldPath.compile("a.b"), payload);
}
@Test(expected = FieldDoesNotExistException.class)
public void nonExistentFieldWhenParentIsAnArray() {
HashMap<String, Object> payload = new HashMap<String, Object>();
HashMap<String, Object> alpha = new HashMap<String, Object>();
HashMap<String, Object> payload = new HashMap<>();
HashMap<String, Object> alpha = new HashMap<>();
alpha.put("b", Arrays.asList(new HashMap<String, Object>()));
payload.put("a", alpha);
this.fieldProcessor.extract(JsonFieldPath.compile("a.b.c"), payload);
@@ -161,21 +161,21 @@ public class JsonFieldProcessorTests {
@Test(expected = FieldDoesNotExistException.class)
public void nonExistentArrayField() {
HashMap<String, Object> payload = new HashMap<String, Object>();
HashMap<String, Object> payload = new HashMap<>();
this.fieldProcessor.extract(JsonFieldPath.compile("a[]"), payload);
}
@Test(expected = FieldDoesNotExistException.class)
public void nonExistentArrayFieldAsTypeDoesNotMatch() {
HashMap<String, Object> payload = new HashMap<String, Object>();
HashMap<String, Object> payload = new HashMap<>();
payload.put("a", 5);
this.fieldProcessor.extract(JsonFieldPath.compile("a[]"), payload);
}
@Test(expected = FieldDoesNotExistException.class)
public void nonExistentFieldBeneathAnArray() {
HashMap<String, Object> payload = new HashMap<String, Object>();
HashMap<String, Object> alpha = new HashMap<String, Object>();
HashMap<String, Object> payload = new HashMap<>();
HashMap<String, Object> alpha = new HashMap<>();
alpha.put("b", Arrays.asList(new HashMap<String, Object>()));
payload.put("a", alpha);
this.fieldProcessor.extract(JsonFieldPath.compile("a.b[].id"), payload);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2016 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.
@@ -45,7 +45,7 @@ public class OutputCapture implements TestRule {
private ByteArrayOutputStream capturedOutput;
private List<Matcher<? super String>> matchers = new ArrayList<Matcher<? super String>>();
private List<Matcher<? super String>> matchers = new ArrayList<>();
@Override
public Statement apply(final Statement base, Description description) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2016 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.
@@ -74,7 +74,7 @@ public final class SnippetMatchers {
private static abstract class AbstractSnippetContentMatcher extends
BaseMatcher<String> {
private List<String> lines = new ArrayList<String>();
private List<String> lines = new ArrayList<>();
protected void addLine(String line) {
this.lines.add(line);