diff --git a/modules/crawlerTest/src/org/labkey/crawlertest/CrawlerTestModule.java b/modules/crawlerTest/src/org/labkey/crawlertest/CrawlerTestModule.java
index dbaef42baa..40ca88586e 100644
--- a/modules/crawlerTest/src/org/labkey/crawlertest/CrawlerTestModule.java
+++ b/modules/crawlerTest/src/org/labkey/crawlertest/CrawlerTestModule.java
@@ -17,7 +17,6 @@
package org.labkey.crawlertest;
import org.jetbrains.annotations.NotNull;
-import org.labkey.api.data.Container;
import org.labkey.api.module.CodeOnlyModule;
import org.labkey.api.module.ModuleContext;
import org.labkey.api.view.WebPartFactory;
@@ -52,11 +51,4 @@ protected void init()
public void doStartup(ModuleContext moduleContext)
{
}
-
- @Override
- @NotNull
- public Collection getSummary(Container c)
- {
- return Collections.emptyList();
- }
}
diff --git a/modules/dumbster/src/com/dumbster/smtp/SmtpActionType.java b/modules/dumbster/src/com/dumbster/smtp/SmtpActionType.java
index 13b6eb6cce..a4b2d72205 100644
--- a/modules/dumbster/src/com/dumbster/smtp/SmtpActionType.java
+++ b/modules/dumbster/src/com/dumbster/smtp/SmtpActionType.java
@@ -104,37 +104,23 @@ public boolean isStateless() {
* @return a String
*/
public String toString() {
- switch(value) {
- case CONNECT_BYTE:
- return "Connect";
- case EHLO_BYTE:
- return "EHLO";
- case MAIL_BYTE:
- return "MAIL";
- case RCPT_BYTE:
- return "RCPT";
- case DATA_BYTE:
- return "DATA";
- case DATA_END_BYTE:
- return ".";
- case QUIT_BYTE:
- return "QUIT";
- case RSET_BYTE:
- return "RSET";
- case VRFY_BYTE:
- return "VRFY";
- case EXPN_BYTE:
- return "EXPN";
- case HELP_BYTE:
- return "HELP";
- case NOOP_BYTE:
- return "NOOP";
- case UNREC_BYTE:
- return "Unrecognized command / data";
- case BLANK_LINE_BYTE:
- return "Blank line";
- default:
- return "Unknown";
- }
+ return switch (value)
+ {
+ case CONNECT_BYTE -> "Connect";
+ case EHLO_BYTE -> "EHLO";
+ case MAIL_BYTE -> "MAIL";
+ case RCPT_BYTE -> "RCPT";
+ case DATA_BYTE -> "DATA";
+ case DATA_END_BYTE -> ".";
+ case QUIT_BYTE -> "QUIT";
+ case RSET_BYTE -> "RSET";
+ case VRFY_BYTE -> "VRFY";
+ case EXPN_BYTE -> "EXPN";
+ case HELP_BYTE -> "HELP";
+ case NOOP_BYTE -> "NOOP";
+ case UNREC_BYTE -> "Unrecognized command / data";
+ case BLANK_LINE_BYTE -> "Blank line";
+ default -> "Unknown";
+ };
}
}
diff --git a/modules/dumbster/src/com/dumbster/smtp/SmtpMessage.java b/modules/dumbster/src/com/dumbster/smtp/SmtpMessage.java
index 3977892c70..f32b06d2dc 100644
--- a/modules/dumbster/src/com/dumbster/smtp/SmtpMessage.java
+++ b/modules/dumbster/src/com/dumbster/smtp/SmtpMessage.java
@@ -123,12 +123,8 @@ public String getBody() {
* @param value header value
*/
private void addHeader(String name, String value) {
- List valueList = headers.get(name);
- if (valueList == null) {
- valueList = new ArrayList<>(1);
- headers.put(name, valueList);
- }
- valueList.add(value);
+ List valueList = headers.computeIfAbsent(name, _ -> new ArrayList<>(1));
+ valueList.add(value);
}
/**
@@ -137,12 +133,8 @@ private void addHeader(String name, String value) {
* @param value header value
*/
private void appendHeader(String name, String value) {
- List valueList = headers.get(name);
- if (valueList == null) {
- valueList = new ArrayList<>(1);
- headers.put(name, valueList);
- }
- valueList.set(0, valueList.get(0) + value);
+ List valueList = headers.computeIfAbsent(name, k -> new ArrayList<>(1));
+ valueList.set(0, valueList.getFirst() + value);
}
/**
diff --git a/modules/dumbster/src/com/dumbster/smtp/SmtpState.java b/modules/dumbster/src/com/dumbster/smtp/SmtpState.java
index a4ff9ab509..07db3c1ca1 100644
--- a/modules/dumbster/src/com/dumbster/smtp/SmtpState.java
+++ b/modules/dumbster/src/com/dumbster/smtp/SmtpState.java
@@ -66,23 +66,16 @@ private SmtpState(byte value) {
* @return a String
*/
public String toString() {
- switch(value) {
- case CONNECT_BYTE:
- return "CONNECT";
- case GREET_BYTE:
- return "GREET";
- case MAIL_BYTE:
- return "MAIL";
- case RCPT_BYTE:
- return "RCPT";
- case DATA_HEADER_BYTE:
- return "DATA_HDR";
- case DATA_BODY_BYTE:
- return "DATA_BODY";
- case QUIT_BYTE:
- return "QUIT";
- default:
- return "Unknown";
- }
+ return switch (value)
+ {
+ case CONNECT_BYTE -> "CONNECT";
+ case GREET_BYTE -> "GREET";
+ case MAIL_BYTE -> "MAIL";
+ case RCPT_BYTE -> "RCPT";
+ case DATA_HEADER_BYTE -> "DATA_HDR";
+ case DATA_BODY_BYTE -> "DATA_BODY";
+ case QUIT_BYTE -> "QUIT";
+ default -> "Unknown";
+ };
}
}
diff --git a/modules/dumbster/src/org/labkey/dumbster/model/DumbsterManager.java b/modules/dumbster/src/org/labkey/dumbster/model/DumbsterManager.java
index 50f5e09026..32eb0bb3d4 100644
--- a/modules/dumbster/src/org/labkey/dumbster/model/DumbsterManager.java
+++ b/modules/dumbster/src/org/labkey/dumbster/model/DumbsterManager.java
@@ -102,14 +102,14 @@ public boolean start()
props.setProperty("mail.smtp.port", Integer.toString(port));
Session session = Session.getInstance(props);
- _log.info("Switching MailHelper to use port " + port);
+ _log.info("Switching MailHelper to use port {}", port);
MailHelper.setSmtpSession(session);
- _log.info("Connecting mail recorder to port " + port);
+ _log.info("Connecting mail recorder to port {}", port);
_server = SimpleSmtpServer.start(port);
if (_server.isStopped())
{
- _log.error("Failed to connect mail recorder. Port " + port + " may be in use.");
+ _log.error("Failed to connect mail recorder. Port {} may be in use.", port);
_server = null;
return false;
}
@@ -123,7 +123,7 @@ public void stop()
// viewing until the next call to start() overwrites.
if (_server != null)
{
- _log.info("Reverting MailHelper to " + AppProps.getInstance().getWebappConfigurationFilename() + " configuration");
+ _log.info("Reverting MailHelper to {} configuration", AppProps.getInstance().getWebappConfigurationFilename());
MailHelper.setSmtpSession(null);
_server.stop();
@@ -138,11 +138,6 @@ public String getName()
return "Dumbster manager";
}
- @Override
- public void shutdownPre()
- {
- }
-
@Override
public void shutdownStarted()
{
@@ -165,10 +160,10 @@ public SmtpMessage[] getMessages()
// Dumbster returns iterator on list which requires synchronization.
synchronized (_server)
{
- Iterator it = _server.getReceivedEmail();
+ Iterator it = _server.getReceivedEmail();
while (it.hasNext())
{
- messageList.add((SmtpMessage) it.next());
+ messageList.add(it.next());
}
}
diff --git a/modules/editableModule/src/org/labkey/editablemodule/EditableModuleModule.java b/modules/editableModule/src/org/labkey/editablemodule/EditableModuleModule.java
index e6149e0132..e2bbe0367d 100644
--- a/modules/editableModule/src/org/labkey/editablemodule/EditableModuleModule.java
+++ b/modules/editableModule/src/org/labkey/editablemodule/EditableModuleModule.java
@@ -17,8 +17,6 @@
package org.labkey.editablemodule;
import org.jetbrains.annotations.NotNull;
-import org.labkey.api.data.Container;
-import org.labkey.api.data.ContainerManager;
import org.labkey.api.module.CodeOnlyModule;
import org.labkey.api.module.ModuleContext;
import org.labkey.api.view.WebPartFactory;
@@ -53,11 +51,4 @@ protected void init()
public void doStartup(ModuleContext moduleContext)
{
}
-
- @Override
- @NotNull
- public Collection getSummary(Container c)
- {
- return Collections.emptyList();
- }
}
\ No newline at end of file
diff --git a/src/org/labkey/junit/rules/TestWatcher.java b/src/org/labkey/junit/rules/TestWatcher.java
index d5ee64db05..e3318a7a0e 100644
--- a/src/org/labkey/junit/rules/TestWatcher.java
+++ b/src/org/labkey/junit/rules/TestWatcher.java
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.jetbrains.annotations.NotNull;
import org.junit.AssumptionViolatedException;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
@@ -16,7 +17,7 @@
public abstract class TestWatcher implements TestRule
{
@Override
- public Statement apply(final Statement base, final Description description) {
+ public @NotNull Statement apply(final @NotNull Statement base, final @NotNull Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
diff --git a/src/org/labkey/remoteapi/security/BulkUpdateGroupCommand.java b/src/org/labkey/remoteapi/security/BulkUpdateGroupCommand.java
index 65f78950e0..c502b8507c 100644
--- a/src/org/labkey/remoteapi/security/BulkUpdateGroupCommand.java
+++ b/src/org/labkey/remoteapi/security/BulkUpdateGroupCommand.java
@@ -56,17 +56,17 @@ public BulkUpdateGroupCommand(@NotNull Integer groupId)
_groupId = groupId;
}
- public void setGroupId(Integer groupId)
+ public void setGroupId(@Nullable Integer groupId)
{
_groupId = groupId;
}
- public void setGroupName(String groupName)
+ public void setGroupName(@Nullable String groupName)
{
_groupName = groupName;
}
- public void setMembers(List
* @throws IOException Can be thrown by the test helper.
- * @throws CommandException Can be thrown by test helper.
*/
@Test
- public void testNameExpressionPreview() throws IOException, CommandException
+ public void testNameExpressionPreview() throws IOException
{
goToProjectHome();
@@ -946,7 +945,7 @@ public void testNameExpressionPreview() throws IOException, CommandException
DataRegionTable sampleTypeList = DataRegionTable.DataRegion(getDriver()).withName("Material").waitFor();
sampleTypeList.clickInsertNewRow();
- WebElement popUpLink = Locator.tagWithClass("span", "labkey-help-pop-up").findElements(getDriver()).get(0);
+ WebElement popUpLink = Locator.tagWithClass("span", "labkey-help-pop-up").findElements(getDriver()).getFirst();
mouseOver(popUpLink);
waitForElement(Locator.tagWithId("div", "helpDiv"));
@@ -1018,7 +1017,7 @@ public void testErrorsAndWarnings()
{
String expectedError = "Name Pattern error: No closing brace found for the substitution pattern starting at position 7.";
checker().verifyEquals("Error message on saving is not as expected.",
- expectedError, errors.get(0));
+ expectedError, errors.getFirst());
}
checker().screenShotIfNewError("Error_On_Save_Failure");
diff --git a/src/org/labkey/test/tests/SampleTypeParentColumnTest.java b/src/org/labkey/test/tests/SampleTypeParentColumnTest.java
index 01f87ea14f..1a116e6891 100644
--- a/src/org/labkey/test/tests/SampleTypeParentColumnTest.java
+++ b/src/org/labkey/test/tests/SampleTypeParentColumnTest.java
@@ -236,7 +236,7 @@ private void regexCheckRowInDataRegion(String dataRegionName, int rowIndex, Stri
List dataInTable = dataRegionTable.getColumnDataAsText(columnName);
- Assert.assertTrue("There were no rows in the data region '" + dataRegionName + "'.", !dataInTable.isEmpty());
+ Assert.assertFalse("There were no rows in the data region '" + dataRegionName + "'.", dataInTable.isEmpty());
Assert.assertTrue("The index given for the row (" + rowIndex + ") is beyond the number of rows in the data region '" + dataRegionName + "' (" + dataInTable.size() + ").", rowIndex < dataInTable.size());
String cellValue = dataInTable.get(rowIndex);
diff --git a/src/org/labkey/test/tests/SampleTypeTest.java b/src/org/labkey/test/tests/SampleTypeTest.java
index b3dd2414aa..bd10a1d59a 100644
--- a/src/org/labkey/test/tests/SampleTypeTest.java
+++ b/src/org/labkey/test/tests/SampleTypeTest.java
@@ -408,7 +408,7 @@ public void testCreateSampleTypeWithExpression()
SampleTypeHelper sampleTypeHelper = new SampleTypeHelper(this);
log("Create a new sample type with a name and name expression");
projectMenu().navigateToFolder(PROJECT_NAME, FOLDER_NAME);
- SampleTypeDefinition definition = new SampleTypeDefinition(sampleTypeName).setNameExpression("${" + fields.get(0).getName() + "}-${batchRandomId}-${randomId}").setFields(fields);
+ SampleTypeDefinition definition = new SampleTypeDefinition(sampleTypeName).setNameExpression("${" + fields.getFirst().getName() + "}-${batchRandomId}-${randomId}").setFields(fields);
sampleTypeHelper.createSampleType(definition);
sampleTypeHelper.goToSampleType(sampleTypeName);
sampleTypeHelper.verifyFields(fields);
@@ -419,7 +419,7 @@ public void testCreateSampleTypeWithExpression()
log("Verify values are as expected with name expression saved");
DataRegionTable drt = sampleTypeHelper.getSamplesDataRegionTable();
- int index = drt.getRowIndex(fieldNames.get(0), "Vee");
+ int index = drt.getRowIndex(fieldNames.getFirst(), "Vee");
assertTrue("Did not find row containing data", index >= 0);
Map rowData = drt.getRowDataAsMap(index);
assertTrue("Name not as expected", rowData.get("Name").startsWith("Vee-"));
@@ -442,8 +442,8 @@ public void testCreateSampleTypeWithExpression()
assertEquals("Number of samples not as expected", 4, sampleTypeHelper.getSampleCount());
- assertTrue("Should have row with first imported value", drt.getRowIndex(fieldNames.get(0), "Dubya") >= 0);
- assertTrue("Should have row with second imported value", drt.getRowIndex(fieldNames.get(0), "Ex") >= 0);
+ assertTrue("Should have row with first imported value", drt.getRowIndex(fieldNames.getFirst(), "Dubya") >= 0);
+ assertTrue("Should have row with second imported value", drt.getRowIndex(fieldNames.getFirst(), "Ex") >= 0);
}
@Test
@@ -462,14 +462,14 @@ public void testImportTypeOptions()
UpdateQueryRowPage updateQueryRowPage = DataRegionTable.findDataRegionWithinWebpart(this, "Sample Type Contents")
.clickInsertNewRow();
updateQueryRowPage.setField("Name", "Name1");
- updateQueryRowPage.setField(fieldNames.get(0), "Bee");
+ updateQueryRowPage.setField(fieldNames.getFirst(), "Bee");
updateQueryRowPage.submit();
log("Try to import overlapping data with TSV");
DataRegionTable drt = sampleHelper.getSamplesDataRegionTable();
ImportDataPage importDataPage = drt.clickImportBulkData();
- String header = "Name\t" + fieldNames.get(0) + "\n";
+ String header = "Name\t" + fieldNames.getFirst() + "\n";
String overlap = "Name1\tToBee\n";
String newData = "Name2\tSee\n";
importDataPage.setText(header + overlap + newData);
@@ -486,12 +486,12 @@ public void testImportTypeOptions()
int index = drt.getRowIndex("Name", "Name1");
assertTrue("Should have row with first sample name", index >= 0);
Map rowData = drt.getRowDataAsMap(index);
- assertEquals(fieldNames.get(0) + " for sample 'Name1' not as expected", "ToBee", rowData.get(fieldNames.get(0)));
+ assertEquals(fieldNames.getFirst() + " for sample 'Name1' not as expected", "ToBee", rowData.get(fieldNames.getFirst()));
index = drt.getRowIndex("Name", "Name2");
assertTrue("Should have a row with the second sample name", index >= 0);
rowData = drt.getRowDataAsMap(index);
- assertEquals(fieldNames.get(0) + " for sample 'Name2' not as expected", "See", rowData.get(fieldNames.get(0)));
+ assertEquals(fieldNames.getFirst() + " for sample 'Name2' not as expected", "See", rowData.get(fieldNames.getFirst()));
log("Try to import overlapping data from file");
final File sampleData = TestFileUtils.getSampleData("simpleSampleType.xls");
@@ -513,17 +513,17 @@ public void testImportTypeOptions()
index = drt.getRowIndex("Name", "Name1");
assertTrue("Should have row with first sample name", index >= 0);
rowData = drt.getRowDataAsMap(index);
- assertEquals(fieldNames.get(0) + " for sample 'Name1' not as expected", "NotTwoBee", rowData.get(fieldNames.get(0)));
+ assertEquals(fieldNames.getFirst() + " for sample 'Name1' not as expected", "NotTwoBee", rowData.get(fieldNames.getFirst()));
index = drt.getRowIndex("Name", "Name2");
assertTrue("Should have a row with the second sample name", index >= 0);
rowData = drt.getRowDataAsMap(index);
- assertEquals(fieldNames.get(0) + " for sample 'Name2' not as expected", "Sea", rowData.get(fieldNames.get(0)));
+ assertEquals(fieldNames.getFirst() + " for sample 'Name2' not as expected", "Sea", rowData.get(fieldNames.getFirst()));
index = drt.getRowIndex("Name", "Name3");
assertTrue("Should have a row with the third sample name", index >= 0);
rowData = drt.getRowDataAsMap(index);
- assertEquals(fieldNames.get(0) + " for sample 'Name' not as expected", "Dee", rowData.get(fieldNames.get(0)));
+ assertEquals(fieldNames.getFirst() + " for sample 'Name' not as expected", "Dee", rowData.get(fieldNames.getFirst()));
}
// I don't think this test is doing what was intended. I'm unclear if this is intended to be a lineage test or a
diff --git a/src/org/labkey/test/tests/ScriptValidationTest.java b/src/org/labkey/test/tests/ScriptValidationTest.java
index ed28d05038..62a9e35bc2 100644
--- a/src/org/labkey/test/tests/ScriptValidationTest.java
+++ b/src/org/labkey/test/tests/ScriptValidationTest.java
@@ -134,21 +134,21 @@ public void doTestCrossFolderSaveRows() throws Exception
list1.add(Map.of("Name", "Manufacturer1"));
InsertRowsCommand cmd1 = new InsertRowsCommand(VEHICLE_SCHEMA, "Manufacturers");
cmd1.getRows().addAll(list1);
- Object manufacturerId = cmd1.execute(cn, getProjectName()).getRows().get(0).get("rowid");
+ Object manufacturerId = cmd1.execute(cn, getProjectName()).getRows().getFirst().get("rowid");
// Create model:
ArrayList> list2 = new ArrayList<>();
list2.add(Map.of("ManufacturerId", manufacturerId, "Name", "Model1"));
InsertRowsCommand cmd2 = new InsertRowsCommand(VEHICLE_SCHEMA, "Models");
cmd2.getRows().addAll(list2);
- Object modelId = cmd2.execute(cn, getProjectName()).getRows().get(0).get("RowId");
+ Object modelId = cmd2.execute(cn, getProjectName()).getRows().getFirst().get("RowId");
assertNotNull("RowId not returned for models insert, values", modelId);
PostCommand saveRowsCommand = prepareSaveRowsCommand("insertWithKeys", getProjectName(), VEHICLE_SCHEMA, VEHICLES_TABLE, "RowId",
new String[]{"ModelId", "Color", "ModelYear", "Milage", "LastService"},
- new Object[][]{new Object[]{modelId, colors.get(0).name, 2000, 1234, new Date()}}, null);
+ new Object[][]{new Object[]{modelId, colors.getFirst().name, 2000, 1234, new Date()}}, null);
CommandResponse response = saveRowsCommand.execute(cn, "/home");
- CaseInsensitiveHashMap row = new CaseInsensitiveHashMap<>((Map)((Map)((List)((Map)((List)response.getParsedData().get("result")).get(0)).get("rows")).get(0)).get("values"));
+ CaseInsensitiveHashMap row = new CaseInsensitiveHashMap<>((Map)((Map)((List)((Map)((List)response.getParsedData().get("result")).getFirst()).get("rows")).getFirst()).get("values"));
// See discussion in: https://github.com/LabKey/testAutomation/pull/1338
Object vehicleRowId = row.get("rowId"); // NOTE: even though the XML for this table defines the case as RowId, using SaveRows/insertWithKeys results in the code converting the first letter of the field names to lowercase, in ResultSetRowMapFactory
assertNotNull("RowId not returned for vehicles insert, keys found: " + StringUtils.join(row.keySet(), ","), vehicleRowId);
@@ -157,9 +157,9 @@ public void doTestCrossFolderSaveRows() throws Exception
src.setColumns(List.of("Container", "TriggerScriptContainer", "RowId", "ModelId", "Milage"));
src.setSorts(List.of(new Sort("RowId", Sort.Direction.DESCENDING)));
SelectRowsResponse sr2 = src.execute(cn, getProjectName());
- assertEquals("Incorrect model", modelId, sr2.getRows().get(0).get("ModelId"));
- assertEquals("Incorrect Milage", 1234, sr2.getRows().get(0).get("Milage"));
- assertEquals("Incorrect RowId for First Record", vehicleRowId, sr2.getRows().get(0).get("rowId"));
+ assertEquals("Incorrect model", modelId, sr2.getRows().getFirst().get("ModelId"));
+ assertEquals("Incorrect Milage", 1234, sr2.getRows().getFirst().get("Milage"));
+ assertEquals("Incorrect RowId for First Record", vehicleRowId, sr2.getRows().getFirst().get("rowId"));
// This should be true for all rows, including the one we just added:
sr2.getRows().forEach(r -> {
@@ -494,7 +494,7 @@ private void doTestValidation() throws Exception
try
{
log("** Test errors: updating hex value");
- ColorRecord yellow = selectColor("Yellow?").get(0);
+ ColorRecord yellow = selectColor("Yellow?").getFirst();
yellow.hex = "shouldn't happen";
updateColors(List.of(yellow));
fail("Should throw an exception");
diff --git a/src/org/labkey/test/tests/SimpleModuleTest.java b/src/org/labkey/test/tests/SimpleModuleTest.java
index 05eadd292e..72707a7d1b 100644
--- a/src/org/labkey/test/tests/SimpleModuleTest.java
+++ b/src/org/labkey/test/tests/SimpleModuleTest.java
@@ -377,7 +377,7 @@ private void doTestColumnValidators() throws Exception
rowMapM.put("Name", "TestManufacturer");
insertCmdM.addRow(rowMapM);
RowsResponse respM = insertCmdM.execute(createDefaultConnection(), getProjectName());
- Object manufacturerId = respM.getRows().get(0).get("RowId");
+ Object manufacturerId = respM.getRows().getFirst().get("RowId");
//This table has one validator defined in the schema XML and one in query XML. First do insert that should fail schema validator:
InsertRowsCommand insertCmd = new InsertRowsCommand("vehicle", "Models");
@@ -405,7 +405,7 @@ private void doTestColumnValidators() throws Exception
rowMap.put("InitialReleaseYear", 2000);
insertCmd.addRow(rowMap);
RowsResponse resp = insertCmd.execute(createDefaultConnection(), getProjectName());
- Object rowId = resp.getRows().get(0).get("RowId");
+ Object rowId = resp.getRows().getFirst().get("RowId");
//now try to update it:
UpdateRowsCommand updateCmd = new UpdateRowsCommand("vehicle", "Models");
@@ -463,7 +463,7 @@ private void submitAndTestExpectedFailure(Command, ?> cmd, String expectedErro
}
List> errors = (List>) responseJson.get("errors");
- String msg = errors.get(0).get("exception").toString();
+ String msg = errors.getFirst().get("exception").toString();
assertEquals("Incorrect exception", expectedError, msg);
}
}
@@ -764,7 +764,7 @@ else if (name.equalsIgnoreCase("F150"))
log("** Updating vehicles...");
RowsResponse updateRows = updateCmd.execute(cn, getProjectName());
assertEquals("Expected to update 1 row.", 1, updateRows.getRowsAffected().intValue());
- assertEquals(4, ((Number) (updateRows.getRows().get(0).get("Milage"))).intValue());
+ assertEquals(4, ((Number) (updateRows.getRows().getFirst().get("Milage"))).intValue());
log("** Testing vehicle.Vehicles details url link...");
@@ -1276,7 +1276,7 @@ private void doTestContainerColumns() throws Exception
SelectRowsResponse selectResp = selectCmd.execute(cn, getProjectName());
assertEquals("Expected to select 1 rows.", 1, selectResp.getRowCount().intValue());
- Map row = selectResp.getRows().get(0);
+ Map row = selectResp.getRows().getFirst();
String entityId = (String)((Map)row.get("EntityId")).get("value");
assertEquals("Expected core.containers path column to return the string: /" + getProjectName(), "/" + getProjectName(), ((Map)row.get("Path")).get("value"));
@@ -1285,7 +1285,7 @@ private void doTestContainerColumns() throws Exception
selectCmd.setColumns(columns);
selectCmd.setRequiredVersion(9.1);
selectResp = selectCmd.execute(cn, getProjectName());
- Map vehicleRow = (Map)(selectResp.getRows().get(0)).get("container");
+ Map vehicleRow = (Map)(selectResp.getRows().getFirst()).get("container");
assertEquals("Expected vehicles.container to return the value: " + entityId, entityId, vehicleRow.get("value"));
assertEquals("Expected vehicles.container to return the displayValue: " + getProjectName(), getProjectName(), vehicleRow.get("displayValue"));
@@ -1304,7 +1304,7 @@ private void doTestRowLevelContainerPath()
List errors = Locators.labkeyError.findElements(getDriver());
if (!errors.isEmpty())
- fail("Error(s) running workbook test. First error: " + errors.get(0).getText());
+ fail("Error(s) running workbook test. First error: " + errors.getFirst().getText());
}
@LogMethod
@@ -1774,7 +1774,7 @@ private void doTestFkLookupFilter()
log("Check metadata for insert");
Map insertFilterGroup = getColorColumnFilterGroup();
- Map insertFilterMap = (Map)((List)insertFilterGroup.get("filters")).get(0);
+ Map insertFilterMap = (Map)((List)insertFilterGroup.get("filters")).getFirst();
assertEquals("Filter column 'Name' for vehicle.Vehicles query not found", "Name", insertFilterMap.get("column"));
assertEquals("Filter operator 'eq' for vehicle.Vehicles query not found", "eq", insertFilterMap.get("operator"));
assertEquals("Filter value 'Green!' for vehicle.Vehicles query not found!", "Green!", insertFilterMap.get("value"));
@@ -1789,7 +1789,7 @@ private void doTestFkLookupFilter()
log("Check metadata for update");
Map updateFilterGroup = getColorColumnFilterGroup();
- Map updateFilterMap = (Map)((List)updateFilterGroup.get("filters")).get(0);
+ Map updateFilterMap = (Map)((List)updateFilterGroup.get("filters")).getFirst();
assertEquals("Filter column 'Name' for vehicle.Vehicles query not found", "Name", updateFilterMap.get("column"));
assertEquals("Filter operator 'contains' for vehicle.Vehicles query not found", "contains", updateFilterMap.get("operator"));
assertEquals("Filter value 'Blue!' for vehicle.Vehicles query not found!", "Bl", updateFilterMap.get("value"));
@@ -1799,11 +1799,11 @@ private void doTestFkLookupFilter()
private Map getColorColumnFilterGroup()
{
Map result = (Map)executeAsyncScript(vehicleMetadataJsQuery);
- Map colorColumnFields = ((List)(((Map)result.get("metaData")).get("fields"))).get(0);
+ Map colorColumnFields = ((List)(((Map)result.get("metaData")).get("fields"))).getFirst();
assertEquals("Column fields for column 'Color' in vehicle.Vehicles query not found!", "Color", colorColumnFields.get("name"));
- return (Map)((List)((Map)colorColumnFields.get("lookup")).get("filterGroups")).get(0);
+ return (Map)((List)((Map)colorColumnFields.get("lookup")).get("filterGroups")).getFirst();
}
@LogMethod
diff --git a/src/org/labkey/test/tests/SpecimenTest.java b/src/org/labkey/test/tests/SpecimenTest.java
index 6dea72c0af..fe574f352b 100644
--- a/src/org/labkey/test/tests/SpecimenTest.java
+++ b/src/org/labkey/test/tests/SpecimenTest.java
@@ -68,12 +68,6 @@ public class SpecimenTest extends SpecimenBaseTest
private final PortalHelper _portalHelper = new PortalHelper(this);
private final String[] SPECIMEN_IDS = {"AAA07XK5-01", "AAA07XK5-02"};
- @Override
- public List getAssociatedModules()
- {
- return Arrays.asList("study");
- }
-
@Override
protected String getProjectName()
{
@@ -310,7 +304,7 @@ private void verifyActorDetails()
int allCheckBoxes = Locator.xpath("//input[@type='checkbox' and @name='notificationIdPairs']").findElements(getDriver()).size();
int checkedCheckBoxes = Locator.xpath("//input[@type='checkbox' and @name='notificationIdPairs' and @checked]").findElements(getDriver()).size();
int disabledCheckBoxes = Locator.xpath("//input[@type='checkbox' and @name='notificationIdPairs' and @disabled]").findElements(getDriver()).size();
- assertTrue("Actor Notification: All actors should be notified if addresses configured.", allCheckBoxes == checkedCheckBoxes + disabledCheckBoxes);
+ assertEquals("Actor Notification: All actors should be notified if addresses configured.", allCheckBoxes, checkedCheckBoxes + disabledCheckBoxes);
clickButton("Cancel");
}
@@ -553,10 +547,10 @@ private void verifyNotificationEmails()
for(WebElement message : messages){message.click();}
List emailMessages1 = mailTable.getMessagesByHeaderAndText("To", USER1);
List emailMessages2 = mailTable.getMessagesByHeaderAndText("To", USER2);
- assertTrue(!emailMessages1.get(0).getBody().contains(_specimen_KCMC));
- assertTrue(emailMessages1.get(0).getBody().contains(_specimen_McMichael));
+ assertFalse(emailMessages1.getFirst().getBody().contains(_specimen_KCMC));
+ assertTrue(emailMessages1.getFirst().getBody().contains(_specimen_McMichael));
assertNotNull("No message found", emailMessages1);
- String messageBody = emailMessages2.get(0).getBody().replaceFirst("-*=_Part_\\d{3}_\\d*.\\d*\\n","");
+ String messageBody = emailMessages2.getFirst().getBody().replaceFirst("-*=_Part_\\d{3}_\\d*.\\d*\\n","");
messageBody = messageBody.replaceAll("Content-Type: text\\/html; charset=UTF-8\n","");
messageBody = messageBody.replaceAll("Content-Transfer-Encoding: 7bit\n", "");
assertTrue("Notification was not as expected.\nExpected:\n" + notification + "\n\nActual:\n" + messageBody, messageBody.contains(notification));
diff --git a/src/org/labkey/test/tests/SurveyTest.java b/src/org/labkey/test/tests/SurveyTest.java
index 151022544e..e712192108 100644
--- a/src/org/labkey/test/tests/SurveyTest.java
+++ b/src/org/labkey/test/tests/SurveyTest.java
@@ -36,6 +36,7 @@
import java.util.List;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.labkey.test.util.PermissionsHelper.EDITOR_ROLE;
import static org.labkey.test.util.PermissionsHelper.READER_ROLE;
@@ -466,7 +467,7 @@ private void verifySurveyFromSubfolder()
// verify question counts on section header
assertTextPresent("Section 1 (2)", "Section 2 (7)");
assertTextNotPresent("-Txt Field", "-Int Field", "-Dt Field");
- assertTrue("Submit button should not be disabled", !isElementPresent(Locator.xpath("//a[contains(@class,'item-disabled')]//span[text() = 'Submit completed form']")));
+ assertFalse("Submit button should not be disabled", isElementPresent(Locator.xpath("//a[contains(@class,'item-disabled')]//span[text() = 'Submit completed form']")));
clickButton("Submit completed form");
waitForText("Surveys: " + SUBFOLDER_SURVEY_DESIGN);
assertTextPresent(SECOND_SURVEY);
diff --git a/src/org/labkey/test/tests/TextChoiceAssayTest.java b/src/org/labkey/test/tests/TextChoiceAssayTest.java
index 6b9c3db4d1..ad02f9f1f2 100644
--- a/src/org/labkey/test/tests/TextChoiceAssayTest.java
+++ b/src/org/labkey/test/tests/TextChoiceAssayTest.java
@@ -163,8 +163,8 @@ public void testEditRunAndResults()
WebElement select = Locator.name(String.format("quf_%s", RUN_TC_FIELD)).findElement(getDriver());
- String newRunValue = unusedRunFieldValues.get(0);
- unusedRunFieldValues.remove(0);
+ String newRunValue = unusedRunFieldValues.getFirst();
+ unusedRunFieldValues.removeFirst();
log(String.format("Update the Run TextChoice field from '%s' to '%s'.", currentRunValue, newRunValue));
@@ -191,7 +191,7 @@ public void testEditRunAndResults()
rowIndex = dataRegionTable.getRowIndex(RESULT_SAMPLE_FIELD, sample);
dataRegionTable.clickEditRow(rowIndex);
select = Locator.name(String.format("quf_%s", RESULT_TC_FIELD)).findElement(getDriver());
- String updatedResultValue = unusedResultFiledValues.get(0);
+ String updatedResultValue = unusedResultFiledValues.getFirst();
log(String.format("Result TextChoice value for sample '%s' will be changed from '%s' to '%s'.", sample, currentResultRowData.get(sample), updatedResultValue));
new OptionSelect<>(select).selectOption(OptionSelect.SelectOption.textOption(updatedResultValue));
diff --git a/src/org/labkey/test/tests/TextChoiceSampleTypeTest.java b/src/org/labkey/test/tests/TextChoiceSampleTypeTest.java
index ff9ddaf7f5..d0aebb29a7 100644
--- a/src/org/labkey/test/tests/TextChoiceSampleTypeTest.java
+++ b/src/org/labkey/test/tests/TextChoiceSampleTypeTest.java
@@ -170,7 +170,7 @@ public void testTextChoiceInSampleTypeDesigner()
List> samples = new ArrayList<>();
samples.add(Map.of(textChoiceFieldName, valuesUsed.get(0), textField, ""));
- samples.add(Map.of(textChoiceFieldName, "", textField, expectedConvertedValues.get(0)));
+ samples.add(Map.of(textChoiceFieldName, "", textField, expectedConvertedValues.getFirst()));
samples.add(Map.of(textChoiceFieldName, valuesUsed.get(1), textField, ""));
samples.add(Map.of(textChoiceFieldName, valuesUsed.get(1), textField, ""));
samples.add(Map.of(textChoiceFieldName, "", textField, expectedConvertedValues.get(1)));
@@ -404,7 +404,7 @@ public void testUpdatingAndDeletingValuesInSampleType() throws IOException, Comm
checker().screenShotIfNewError("Edit_Values_Locked_Locked_Error");
log("Validate that unused values are not locked and can be deleted.");
- value = expectedUnLockedValues.get(0);
+ value = expectedUnLockedValues.getFirst();
fieldRow.selectTextChoiceValue(value);
if (checker().verifyTrue(String.format("Delete button is not enabled for value '%s', it should be.", value),
@@ -514,8 +514,8 @@ public void testUpdatingAndDeletingValuesInSampleType() throws IOException, Comm
fieldRow = updatePage.getFieldsPanel().getField(textChoiceFieldName);
fieldRow = fieldRow.expand();
- valueToUpdate = expectedUnLockedValues.get(0);
- updatedValue = expectedLockedValues.get(0);
+ valueToUpdate = expectedUnLockedValues.getFirst();
+ updatedValue = expectedLockedValues.getFirst();
actualMsg = fieldRow.updateTextChoiceValueExpectError(valueToUpdate, updatedValue);
expectedMsg = String.format("\"%s\" already exists in the list of values.", updatedValue);
@@ -642,8 +642,8 @@ public void testSetTextChoiceValueForSample() throws IOException, CommandExcepti
refresh();
- String sample = availableSamples.get(0);
- availableSamples.remove(0);
+ String sample = availableSamples.getFirst();
+ availableSamples.removeFirst();
log(String.format("Edit the sample '%s' and validate TextChoice values are shown in the select for the field.", sample));
@@ -665,7 +665,7 @@ public void testSetTextChoiceValueForSample() throws IOException, CommandExcepti
LabKeyAssert.assertEqualsSorted(String.format("Options for the '%s' field not as expected. Fatal error.", textChoiceFieldName),
tcValues, options);
- String expectedValue = tcValues.get(0);
+ String expectedValue = tcValues.getFirst();
updateSamplePage.setField(textChoiceFieldName, OptionSelect.SelectOption.textOption(expectedValue));
updateSamplePage.submit();
@@ -678,8 +678,8 @@ public void testSetTextChoiceValueForSample() throws IOException, CommandExcepti
expectedValue, actualValue);
log("Use import to update/set a TextChoice value.");
- sample = availableSamples.get(0);
- availableSamples.remove(0);
+ sample = availableSamples.getFirst();
+ availableSamples.removeFirst();
expectedValue = tcValues.get(1);
List> sampleData = new ArrayList<>();
@@ -696,8 +696,8 @@ public void testSetTextChoiceValueForSample() throws IOException, CommandExcepti
log("Finally validate that an invalid TextChoice value used during sample import/update fails.");
- sample = availableSamples.get(0);
- availableSamples.remove(0);
+ sample = availableSamples.getFirst();
+ availableSamples.removeFirst();
String invalidValue = "ZZZZ";
diff --git a/src/org/labkey/test/tests/TimeChartAPITest.java b/src/org/labkey/test/tests/TimeChartAPITest.java
index 1f33efd2bd..20b5507b1e 100644
--- a/src/org/labkey/test/tests/TimeChartAPITest.java
+++ b/src/org/labkey/test/tests/TimeChartAPITest.java
@@ -25,7 +25,6 @@
import org.labkey.test.categories.Daily;
import org.labkey.test.categories.Reports;
import org.labkey.test.tests.visualization.TimeChartTest;
-import org.labkey.test.util.CachingSupplier;
import org.labkey.test.util.DataRegionTable;
import org.labkey.test.util.LogMethod;
import org.labkey.test.util.PortalHelper;
@@ -336,7 +335,7 @@ private void testVisApi(File htmlPage, String[] testTitles, @Nullable int[] test
int columnIndex = table.getColumnIndexStrict(columnName);
List