Skip to content

Commit

Permalink
cleanup: apply linter suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pfeil committed Jan 8, 2025
1 parent e61ba54 commit 4fd4543
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package edu.kit.datamanager.pit.web;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import edu.kit.datamanager.pit.typeregistry.ITypeRegistry;
import jakarta.servlet.ServletContext;

Expand Down Expand Up @@ -45,6 +41,7 @@

import org.hamcrest.Matchers;

import static org.junit.jupiter.api.Assertions.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;

Expand Down Expand Up @@ -111,7 +108,7 @@ void checkTestSetup() {
assertNotNull(this.inMemory);
ServletContext servletContext = webApplicationContext.getServletContext();
assertNotNull(servletContext);
assertTrue(servletContext instanceof MockServletContext);
assertInstanceOf(MockServletContext.class, servletContext);

SpringTestHelper springTestHelper = new SpringTestHelper(webApplicationContext);
springTestHelper.assertSingleBeanInstanceOf(ITypingRestResource.class);
Expand Down Expand Up @@ -145,7 +142,6 @@ void testExtensiveRecordDryRun() throws Exception {
// as we use an in-memory data structure, lets not make it too large.
int numAttributes = 100;
int numValues = 100;
assertTrue(numAttributes * numValues > 256);
PIDRecord r = RecordTestHelper.getFakePidRecord(numAttributes, numValues, "sandboxed/", pidGenerator);

String rJson = ApiMockUtils.serialize(r);
Expand Down Expand Up @@ -173,7 +169,6 @@ void testExtensiveRecordWithoutDryRun() throws Exception {
// as we use an in-memory data structure, lets not make it too large.
int numAttributes = 100;
int numValues = 100;
assertTrue(numAttributes * numValues > 256);
PIDRecord r = RecordTestHelper.getFakePidRecord(numAttributes, numValues, "sandboxed/", pidGenerator);

String rJson = ApiMockUtils.serialize(r);
Expand Down Expand Up @@ -238,7 +233,7 @@ void testRecordWithAdditionalAttribute() throws Exception {
void testResolvingValidRecordWithValidation() throws Exception {
this.testExtensiveRecordWithoutDryRun();
assertEquals(1, knownPidsDao.count());
String validPid = knownPidsDao.findAll().iterator().next().getPid();
String validPid = knownPidsDao.findAll().getFirst().getPid();
this.mockMvc
.perform(
get("/api/v1/pit/pid/" + validPid)
Expand All @@ -255,7 +250,7 @@ void testResolvingValidRecordWithValidationFail() throws Exception {
// note: this test disables validation...
this.testExtensiveRecordWithoutDryRun();
assertEquals(1, knownPidsDao.count());
String validPid = knownPidsDao.findAll().iterator().next().getPid();
String validPid = knownPidsDao.findAll().getFirst().getPid();

PIDRecord r = inMemory.queryPid(validPid);
r.addEntry("21.T11148/076759916209e5d62bd5", "", "21.T11148/b9b76f887845e32d29f7");
Expand All @@ -275,6 +270,6 @@ void testResolvingValidRecordWithValidationFail() throws Exception {
.andExpect(MockMvcResultMatchers.status().isBadRequest())
.andExpect(MockMvcResultMatchers.jsonPath("$.detail", Matchers.containsString("Missing mandatory types: [")))
.andReturn();
assertTrue(0 < result.getResponse().getContentAsString().length());
assertFalse(result.getResponse().getContentAsString().isEmpty());
}
}

0 comments on commit 4fd4543

Please sign in to comment.