Skip to content

Commit

Permalink
Merge pull request #2 from samvaity/test-info-reveiw
Browse files Browse the repository at this point in the history
File path test updates
  • Loading branch information
billwert authored Jan 6, 2023
2 parents 218cfcc + 773492e commit 9d2ecc5
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;

import java.io.BufferedReader;
import java.io.File;
Expand All @@ -43,7 +41,6 @@
@SuppressWarnings("deprecation")
public class TestProxyTests extends TestBase {
static TestProxyTestServer server;
private static final String LOCAL_FILE_PATH = "src/test/resources/session-records/";
private static final ObjectMapper RECORD_MAPPER = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);

private static List<TestProxySanitizer> customSanitizer = new ArrayList<>();
Expand All @@ -54,13 +51,6 @@ public class TestProxyTests extends TestBase {
customSanitizer.add(new TestProxySanitizer("$..modelId", REDACTED, TestProxySanitizerType.BODY));
}

private TestInfo testInfo;

@BeforeEach
void init(TestInfo testInfo) {
this.testInfo = testInfo;
}

@BeforeAll
public static void setupClass() {
enableTestProxy();
Expand Down Expand Up @@ -227,8 +217,8 @@ public void testPlaybackWithRedaction() {
}

private RecordedTestProxyData readDataFromFile() {
File recordFile = new File(LOCAL_FILE_PATH + testInfo.getTestClass().get().getSimpleName() + "." + testInfo.getDisplayName().substring(0, testInfo.getDisplayName().length() - 2) + ".json");

String filePath = InterceptorManager.getRecordFolder() + "\\" + this.testContextManager.getTestPlaybackRecordingName() + ".json";
File recordFile = new File(filePath);
try (BufferedReader reader = Files.newBufferedReader(recordFile.toPath())) {
return RECORD_MAPPER.readValue(reader, RecordedTestProxyData.class);
} catch (IOException ex) {
Expand Down

0 comments on commit 9d2ecc5

Please sign in to comment.