Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-6847] Use diamond operator #669

Merged
merged 2 commits into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public class AbstractSurefireMojoTest {
public void setupMojo() {
Artifact mojoArtifact = mojo.getMojoArtifact();

mojo.setPluginArtifactMap(new LinkedHashMap<String, Artifact>());
mojo.setPluginArtifactMap(new LinkedHashMap<>());
mojo.getPluginArtifactMap().put(mojoArtifact.getGroupId() + ":" + mojoArtifact.getArtifactId(), mojoArtifact);
Artifact forkedBooter = new DefaultArtifact(
"org.apache.maven.surefire",
Expand All @@ -143,7 +143,7 @@ public void setupMojo() {
mock(ArtifactHandler.class));
mojo.getPluginArtifactMap().put("org.apache.maven.surefire:surefire-booter", forkedBooter);

mojo.setProjectArtifactMap(new LinkedHashMap<String, Artifact>());
mojo.setProjectArtifactMap(new LinkedHashMap<>());

MavenSession session = mock(MavenSession.class);
mojo.setSession(session);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ public void testLocateTestClassesFromMultipleArtifactsWithType() throws Exceptio
List<String> scanDependencies = new ArrayList<>();
scanDependencies.add("org.surefire.dependency:dependent-artifact3:test-jar");

List<String> include = new ArrayList<String>();
List<String> include = new ArrayList<>();
include.add("**/*A.java");
List<String> exclude = new ArrayList<String>();
List<String> exclude = new ArrayList<>();

List<Artifact> artifacts = Arrays.asList(mainArtifact, testArtifact);

Expand Down Expand Up @@ -223,7 +223,7 @@ public void testLocateTestClassesFromMultipleVersionsOfArtifact() throws Excepti
assertEquals(1, classNames.size());
assertEquals("org.test2.ClassA", classNames.getClassName(0));

Map<String, String> props = new HashMap<String, String>();
Map<String, String> props = new HashMap<>();
classNames.writeTo(props);
assertEquals(1, props.size());
assertFalse(props.values().contains("org.test.ClassA"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void testFileNameWithoutSuffix() {
WrappedReportEntry wrappedReportEntry =
new WrappedReportEntry(reportEntry, ReportEntryType.SUCCESS, 12, null, null);
reporter = new FileReporter(reportDir, null, Charset.defaultCharset(), false, false, false);
reporter.testSetCompleted(wrappedReportEntry, createTestSetStats(), new ArrayList<String>());
reporter.testSetCompleted(wrappedReportEntry, createTestSetStats(), new ArrayList<>());

File expectedReportFile = new File(reportDir, TEST_NAME + ".txt");
assertTrue(
Expand All @@ -70,7 +70,7 @@ public void testFileNameWithSuffix() {
WrappedReportEntry wrappedReportEntry =
new WrappedReportEntry(reportEntry, ReportEntryType.SUCCESS, 12, null, null);
reporter = new FileReporter(reportDir, suffixText, Charset.defaultCharset(), false, false, false);
reporter.testSetCompleted(wrappedReportEntry, createTestSetStats(), new ArrayList<String>());
reporter.testSetCompleted(wrappedReportEntry, createTestSetStats(), new ArrayList<>());

File expectedReportFile = new File(reportDir, TEST_NAME + "-" + suffixText + ".txt");
assertTrue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void setIfDirScannerAware(Object o, DirectoryScannerParameters dirScanner

public void setMainCliOptions(Object o, List<CommandLineOption> options) {
if (baseProviderFactory.isAssignableFrom(o.getClass())) {
List<Enum<?>> newOptions = checkedList(new ArrayList<Enum<?>>(options.size()), commandLineOptionsClass);
List<Enum<?>> newOptions = checkedList(new ArrayList<>(options.size()), commandLineOptionsClass);
Collection<Integer> ordinals = toOrdinals(options);
for (Enum<?> e : commandLineOptionsClass.getEnumConstants()) {
if (ordinals.contains(e.ordinal())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void testProviderProperties() {
SurefireReflector surefireReflector = getReflector();
Object foo = getFoo();

surefireReflector.setProviderProperties(foo, new HashMap<String, String>());
surefireReflector.setProviderProperties(foo, new HashMap<>());
assertTrue(isCalled(foo));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public File getBaseDir() {

public String[] getStringsOrderInLog(String[] strings) throws VerificationException {
String[] retArr = new String[strings.length];
List<String> strList = new ArrayList<String>(Arrays.asList(strings));
List<String> strList = new ArrayList<>(Arrays.asList(strings));
int i = 0;
for (String line : loadLogLines()) {
for (int j = 0; j < strList.size(); j++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ParallelTest
@DataProvider( parallel = true, name = "dataProvider" )
public Iterator<Object[]> dataProvider()
{
List<Object[]> data = new ArrayList<Object[]>();
List<Object[]> data = new ArrayList<>();
for ( int i = 0; i < 5000; i++ )
{
data.add( new Object[]{ "ID_" + i } );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void testCreateProvider() {

private JUnit4Provider getJUnit4Provider() {
BaseProviderFactory providerParameters = new BaseProviderFactory(true);
providerParameters.setProviderProperties(new HashMap<String, String>());
providerParameters.setProviderProperties(new HashMap<>());
providerParameters.setClassLoaders(getClass().getClassLoader());
providerParameters.setTestRequest(new TestRequest(null, null, null));
providerParameters.setRunOrderParameters(new RunOrderParameters("hourly", new File("")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
@Deprecated
public class AsynchronousRunner implements RunnerScheduler {
private final List<Future<Object>> futures = Collections.synchronizedList(new ArrayList<Future<Object>>());
private final List<Future<Object>> futures = Collections.synchronizedList(new ArrayList<>());

private final ExecutorService fService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public class ConfigurableParallelComputer extends Computer {

private final ExecutorService fService;

private final List<AsynchronousRunner> nonBlockers =
Collections.synchronizedList(new ArrayList<AsynchronousRunner>());
private final List<AsynchronousRunner> nonBlockers = Collections.synchronizedList(new ArrayList<>());

public ConfigurableParallelComputer() {
this(true, true, Executors.newCachedThreadPool(DAEMON_THREAD_FACTORY), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
final class SharedThreadPoolStrategy extends AbstractThreadPoolStrategy {
SharedThreadPoolStrategy(ConsoleLogger logger, ExecutorService threadPool) {
super(logger, threadPool, new ConcurrentLinkedQueue<Future<?>>());
super(logger, threadPool, new ConcurrentLinkedQueue<>());
}

@Override
Expand Down