Add test for unknown node identifiers on modify peer command
[jFCPlib.git] / src / main / java / net / pterodactylus / fcp / GetNode.java
index 799b44b..72b90c4 100644 (file)
@@ -18,6 +18,8 @@
 
 package net.pterodactylus.fcp;
 
+import java.util.Optional;
+
 /**
  * The “GetNode” command returns the darknet or opennet noderef of the node,
  * optionally including private and volatile data.
@@ -27,17 +29,18 @@ package net.pterodactylus.fcp;
 public class GetNode extends FcpMessage {
 
        /**
-        * Creates a “GetNode” command that returns the darknet noderef of the node.
+        * Creates a “GetNode” command that returns the darknet noderef of the
+        * node.
         */
        public GetNode() {
                this(null, null, null);
        }
 
        /**
-        * Creates a “GetNode” command that returns the request noderef of the node,
-        * including private and volatile data, if requested. If any of the Boolean
-        * parameters are <code>null</code> the parameter is ignored and the node’s
-        * default value is used.
+        * Creates a “GetNode” command that returns the request noderef of the
+        * node, including private and volatile data, if requested. If any of the
+        * Boolean parameters are <code>null</code> the parameter is ignored and
+        * the node’s default value is used.
         *
         * @param giveOpennetRef
         *            <code>true</code> to request the opennet noderef,
@@ -48,7 +51,12 @@ public class GetNode extends FcpMessage {
         *            <code>true</code> to include volatile data in the noderef
         */
        public GetNode(Boolean giveOpennetRef, Boolean withPrivate, Boolean withVolatile) {
+               this(null, giveOpennetRef, withPrivate, withVolatile);
+       }
+
+       public GetNode(String identifier, Boolean giveOpennetRef, Boolean withPrivate, Boolean withVolatile) {
                super("GetNode");
+               Optional.ofNullable(identifier).ifPresent(i -> setField("Identifier", i));
                if (giveOpennetRef != null) {
                        setField("GiveOpennetRef", String.valueOf(giveOpennetRef));
                }