Fix errorprone discovered issues. Many tests are missing @Test annotation. Once enabled, a broken test was found & fixed in WorkflowItemRestRepositoryIT.

This commit is contained in:
Tim Donohue
2025-07-28 15:29:32 -05:00
parent 14ecbf0587
commit 2b27d5536b
4 changed files with 13 additions and 2 deletions

View File

@@ -1469,6 +1469,7 @@ public class CollectionRestRepositoryIT extends AbstractControllerIntegrationTes
authorizeService.removePoliciesActionFilter(context, eperson, Constants.WRITE);
}
@Test
public void patchCollectionMetadataAuthorized() throws Exception {
runPatchMetadataTests(admin, 200);
}

View File

@@ -913,6 +913,7 @@ public class WorkflowItemRestRepositoryIT extends AbstractControllerIntegrationT
*
* @throws Exception
*/
@Test
public void validationErrorsRequiredMetadataTest() throws Exception {
context.turnOffAuthorisationSystem();
@@ -936,6 +937,7 @@ public class WorkflowItemRestRepositoryIT extends AbstractControllerIntegrationT
XmlWorkflowItem witem = WorkflowItemBuilder.createWorkflowItem(context, col1)
.withTitle("Workflow Item 1")
.withIssueDate("2017-10-17")
.grantLicense()
.build();
//4. a workflow item without the dateissued required field
@@ -947,12 +949,12 @@ public class WorkflowItemRestRepositoryIT extends AbstractControllerIntegrationT
String authToken = getAuthToken(eperson.getEmail(), password);
getClient(authToken).perform(get("/api/workflow/worfklowitems/" + witem.getID()))
getClient(authToken).perform(get("/api/workflow/workflowitems/" + witem.getID()))
.andExpect(status().isOk())
.andExpect(jsonPath("$.errors").doesNotExist())
;
getClient(authToken).perform(get("/api/workflow/worfklowitems/" + witemMissingFields.getID()))
getClient(authToken).perform(get("/api/workflow/workflowitems/" + witemMissingFields.getID()))
.andExpect(status().isOk())
.andExpect(jsonPath("$.errors[?(@.message=='error.validation.required')]",
Matchers.contains(

View File

@@ -2621,6 +2621,7 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
(witem, "Workspace Item 1", "2019-01-01", "ExtraEntry"))));
}
@Test
public void patchReplaceMetadataOnItemStillInSubmissionTest() throws Exception {
context.turnOffAuthorisationSystem();
@@ -5922,6 +5923,7 @@ public class WorkspaceItemRestRepositoryIT extends AbstractControllerIntegration
.andExpect(jsonPath("$.sections.upload.files[0].accessConditions", empty()));
}
@Test
public void deleteWorkspaceItemWithMinRelationshipsTest() throws Exception {
context.turnOffAuthorisationSystem();
@@ -7964,6 +7966,7 @@ ResourcePolicyBuilder.createResourcePolicy(context, null, adminGroup)
)));
}
@Test
public void verifyBitstreamPolicyNotDuplicatedTest() throws Exception {
context.turnOffAuthorisationSystem();

View File

@@ -459,6 +459,7 @@ public class RequestCopyFeatureIT extends AbstractControllerIntegrationTest {
.andExpect(jsonPath("$._embedded").doesNotExist());
}
@Test
public void requestACopyItemTypeLoggedAsAnonymous() throws Exception {
configurationService.setProperty("request.item.type", "logged");
@@ -493,6 +494,7 @@ public class RequestCopyFeatureIT extends AbstractControllerIntegrationTest {
);
}
@Test
public void requestACopyItemTypeEmptyAsAnonymous() throws Exception {
configurationService.setProperty("request.item.type", "");
@@ -507,6 +509,7 @@ public class RequestCopyFeatureIT extends AbstractControllerIntegrationTest {
.andExpect(jsonPath("$._embedded").doesNotExist());
}
@Test
public void requestACopyItemTypeEmptyAsEperson() throws Exception {
configurationService.setProperty("request.item.type", "");
@@ -523,6 +526,7 @@ public class RequestCopyFeatureIT extends AbstractControllerIntegrationTest {
.andExpect(jsonPath("$._embedded").doesNotExist());
}
@Test
public void requestACopyItemTypeBogusValueAsAnonymous() throws Exception {
configurationService.setProperty("request.item.type", "invalid value");
@@ -537,6 +541,7 @@ public class RequestCopyFeatureIT extends AbstractControllerIntegrationTest {
.andExpect(jsonPath("$._embedded").doesNotExist());
}
@Test
public void requestACopyItemTypeBogusValueAsEperson() throws Exception {
configurationService.setProperty("request.item.type", "invalid value");