-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#65 modification times are only stored for existing files in Director…
…yCodeResolver
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
jte/src/test/java/gg/jte/resolve/DirectoryCodeResolverTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package gg.jte.resolve; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.lang.reflect.Field; | ||
import java.nio.file.Paths; | ||
import java.util.Map; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class DirectoryCodeResolverTest { | ||
|
||
DirectoryCodeResolver codeResolver = new DirectoryCodeResolver(Paths.get("src/test/resources/benchmark")); | ||
|
||
@SuppressWarnings("unchecked") | ||
@Test | ||
void modificationTimeDoesNotLeak() throws Exception { | ||
Field modificationTimesField = codeResolver.getClass().getDeclaredField("modificationTimes"); | ||
modificationTimesField.setAccessible(true); | ||
Map<String, Long> modificationTimes = (Map<String, Long>)modificationTimesField.get(codeResolver); | ||
|
||
codeResolver.resolve("doesNotExist.jte"); | ||
|
||
assertThat(modificationTimes).isEmpty(); | ||
} | ||
} |