mardi 30 juin 2020

IllegalStateException sometime occures and some time not

I have a test suite for my application, and some of the time when I'm building my project one the tests raises this error, and sometimes, if I run all the tests again, the error doesn't appear. and if I run this specific test seperatly it always passes.

this is the error:

com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalStateException: Interrupted while loading cache item
  at functional.TestFile.init(TestFile.java:32)
Caused by: java.lang.IllegalStateException: Interrupted while loading cache item
  at functional.TestFile.init(TestFile.java:32)
Caused by: java.lang.InterruptedException
  at functional.TestFile.init(TestFile.java:32)

and this is the line which raises the error:

private File testDirectory;
private Injector injector;

@BeforeClass
public void init() throws Exception {
    testDirectory = Files.createTempDirectory(null).toFile();
    injector = Guice.createInjector(Modules.override(new ProductionModule(new ApplicationSettings().getProperties())).with(new TestModule(testDirectory)));
}

the injector line is line num 32.

anyone knows why it is not stable and why sometime ot pass and sometime not?

Aucun commentaire:

Enregistrer un commentaire