Skip to content

Commit

Permalink
Assert not null for ComputationManager and close FileSystem in test
Browse files Browse the repository at this point in the history
  • Loading branch information
yichen88 committed Sep 6, 2017
1 parent 26b8875 commit c0b2bf6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Expand Up @@ -53,18 +53,21 @@ public void testToTask() throws Exception {
PhaseTapChanger tapChanger = network.getTwoWindingsTransformer("PS1").getPhaseTapChanger();
assertEquals(1, tapChanger.getTapPosition());


TapChangeAction action = new TapChangeAction("PS1", 2);
ModificationTask task = action.toTask();
FileSystem fileSystem = Jimfs.newFileSystem(Configuration.unix());
Path localDir = fileSystem.getPath("/tmp");
ComputationManager computationManager = new LocalComputationManager(localDir);
task.modify(network, computationManager);
assertEquals(2, tapChanger.getTapPosition());
try (FileSystem fileSystem = Jimfs.newFileSystem(Configuration.unix())) {
Path localDir = fileSystem.getPath("/tmp");
ComputationManager computationManager = new LocalComputationManager(localDir);
task.modify(network, computationManager);
assertEquals(2, tapChanger.getTapPosition());

try {
action.toTask(null);
fail();
} catch (UnsupportedOperationException exc) {
try {
action.toTask(null);
fail();
} catch (UnsupportedOperationException exc) {
}
}

}
}
Expand Up @@ -77,6 +77,7 @@ public StateAnalyzer(OnlineWorkflowContext context, MontecarloSampler sampler, L
Objects.requireNonNull(stateListener);
Objects.requireNonNull(constraintsModifier);
Objects.requireNonNull(parameters);
Objects.requireNonNull(computationManager);
this.context = context;
this.sampler = sampler;
this.loadFlow = loadFlow;
Expand Down

0 comments on commit c0b2bf6

Please sign in to comment.