Skip to content

Commit

Permalink
Add throws exception javadoc on fetchNode() (#37)
Browse files Browse the repository at this point in the history
Signed-off-by: yichen88 <[email protected]>
  • Loading branch information
yichen88 authored Mar 23, 2020
1 parent 22d4261 commit 4ab5835
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions afs-core/src/main/java/com/powsybl/afs/AppFileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.powsybl.afs.storage.AfsStorageException;
import com.powsybl.afs.storage.AppStorage;
import com.powsybl.afs.storage.EventsBus;
import com.powsybl.afs.storage.NodeInfo;
Expand Down Expand Up @@ -129,6 +130,7 @@ public <T extends ProjectFile> T findProjectFile(String projectFileId, Class<T>
/**
* Retrieve a project node with undefined class
* @param nodeId the node Id
* @throws AfsStorageException if the node not found
* @return a typed node
*/
public AbstractNodeBase fetchNode(String nodeId) {
Expand Down
8 changes: 8 additions & 0 deletions afs-core/src/test/java/com/powsybl/afs/AfsBaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.google.common.jimfs.Configuration;
import com.google.common.jimfs.Jimfs;
import com.powsybl.afs.mapdb.storage.MapDbAppStorage;
import com.powsybl.afs.storage.AfsStorageException;
import com.powsybl.afs.storage.AppStorage;
import com.powsybl.afs.storage.InMemoryEventsBus;
import com.powsybl.afs.storage.NodeGenericMetadata;
Expand Down Expand Up @@ -509,6 +510,13 @@ public void fetchNodeTest() {
checkResult.accept(createdFile, afs.fetchNode(createdFile.getId()));
checkResult.accept(nestedFile, afs.fetchNode(nestedFile.getId()));
checkResult.accept(projectFolder, afs.fetchNode(projectFolder.getId()));

try {
afs.fetchNode(UUID.randomUUID().toString());
fail();
} catch (AfsStorageException e) {
// ignored
}
}

@Test
Expand Down

0 comments on commit 4ab5835

Please sign in to comment.