Skip to content

Commit

Permalink
test: use <> diamond operator in Java tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vlsi committed Jun 16, 2023
1 parent f7e9673 commit 4e219c0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ public void testNormalizeListWithEmptyList() {

@Test
public void testNormalizeListWithEmptyArrayList() {
Collection<JMeterProperty> emptyCollection = new ArrayList<JMeterProperty>();
Collection<JMeterProperty> emptyCollection = new ArrayList<>();
Collection<JMeterProperty> newCollection = dummyProperty.normalizeList(emptyCollection);
assertThat(newCollection, CoreMatchers.not(CoreMatchers.sameInstance(emptyCollection)));
assertThat(newCollection, CoreMatchers.equalTo(emptyCollection));
}

@Test
public void testNormalizeListWithFilledArrayList() {
List<JMeterProperty> filledCollection = new ArrayList<JMeterProperty>();
List<JMeterProperty> filledCollection = new ArrayList<>();
filledCollection.add(new StringProperty("key", "value"));
Collection<JMeterProperty> newCollection = dummyProperty.normalizeList(filledCollection);
assertThat(newCollection, CoreMatchers.not(CoreMatchers.sameInstance(filledCollection)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void testBug62281MapProperty() {

@Test
public void testGetPropertyTypeOfEmptyMap() {
MapProperty props = new MapProperty("foo", new HashMap<Object, Object>());
MapProperty props = new MapProperty("foo", new HashMap<>());
assertThat(props.getPropertyType(), CoreMatchers.equalTo(NullProperty.class));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void testBug63033() throws SaxonApiException {
@Test
public void testputValuesForXPathInListUsingSaxon() throws SaxonApiException, FactoryConfigurationError{
String xPathQuery="//Employees/Employee/role";
ArrayList<String> matchStrings = new ArrayList<String>();
ArrayList<String> matchStrings = new ArrayList<>();
boolean fragment = false;
String namespaces = "age=http://www.w3.org/2003/01/geo/wgs84_pos#";
int matchNumber = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,15 @@ public void testParserSet() throws Exception {
public void testParserList() throws Exception {
HTMLParser p = (HTMLParser) BaseParser.getParser(parserName);
filetest(p, TESTS[testNumber].fileName, TESTS[testNumber].baseUrl, TESTS[testNumber].expectedList,
new Vector<URLString>(), true, TESTS[testNumber].userAgent);
new Vector<>(), true, TESTS[testNumber].userAgent);
}

public void testSpecificParserList() throws Exception {
HTMLParser p = (HTMLParser) BaseParser.getParser(parserName);
filetest(p, SPECIFIC_PARSER_TESTS[testNumber].fileName,
SPECIFIC_PARSER_TESTS[testNumber].baseUrl,
SPECIFIC_PARSER_TESTS[testNumber].expectedList,
new ArrayList<URLString>(), true,
new ArrayList<>(), true,
SPECIFIC_PARSER_TESTS[testNumber].userAgent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,8 @@ private HTTPSamplerBase getSamplerForRequest(String url, String request, String
}
req.parse(bis);
bis.close();
Map<String, String> pageEncodings = Collections.synchronizedMap(new HashMap<String, String>());
Map<String, String> formEncodings = Collections.synchronizedMap(new HashMap<String, String>());
Map<String, String> pageEncodings = Collections.synchronizedMap(new HashMap<>());
Map<String, String> formEncodings = Collections.synchronizedMap(new HashMap<>());
if(url != null && contentEncoding != null) {
pageEncodings.put(url, contentEncoding);
}
Expand Down

0 comments on commit 4e219c0

Please sign in to comment.