From 4ab583525ee40221cde5a21997b6d4584ddb4849 Mon Sep 17 00:00:00 2001 From: yichen88 <30594441+yichen88@users.noreply.github.com> Date: Mon, 23 Mar 2020 12:07:37 +0100 Subject: [PATCH] Add throws exception javadoc on fetchNode() (#37) Signed-off-by: yichen88 --- afs-core/src/main/java/com/powsybl/afs/AppFileSystem.java | 2 ++ afs-core/src/test/java/com/powsybl/afs/AfsBaseTest.java | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/afs-core/src/main/java/com/powsybl/afs/AppFileSystem.java b/afs-core/src/main/java/com/powsybl/afs/AppFileSystem.java index f58abe38..3af403ca 100644 --- a/afs-core/src/main/java/com/powsybl/afs/AppFileSystem.java +++ b/afs-core/src/main/java/com/powsybl/afs/AppFileSystem.java @@ -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; @@ -129,6 +130,7 @@ public T findProjectFile(String projectFileId, Class /** * 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) { diff --git a/afs-core/src/test/java/com/powsybl/afs/AfsBaseTest.java b/afs-core/src/test/java/com/powsybl/afs/AfsBaseTest.java index 5c8e537a..0b5c3131 100644 --- a/afs-core/src/test/java/com/powsybl/afs/AfsBaseTest.java +++ b/afs-core/src/test/java/com/powsybl/afs/AfsBaseTest.java @@ -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; @@ -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