From 84fd604cf98f71e120002f5162abd820783abc77 Mon Sep 17 00:00:00 2001 From: Ganesh Date: Mon, 11 Apr 2022 16:46:56 +0530 Subject: grpcServer unit test cases added Signed-off-by: Ganesh Change-Id: Ibc7eed90a862ca60c23e993519490b2703f1d7a9 Issue-ID: CLI-443 --- .../grpc/server/OpenInterfaceGrpcServerTest.java | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 grpc/grpc-server/src/test/java/org/open/infc/grpc/server/OpenInterfaceGrpcServerTest.java diff --git a/grpc/grpc-server/src/test/java/org/open/infc/grpc/server/OpenInterfaceGrpcServerTest.java b/grpc/grpc-server/src/test/java/org/open/infc/grpc/server/OpenInterfaceGrpcServerTest.java new file mode 100644 index 00000000..f25ffc5a --- /dev/null +++ b/grpc/grpc-server/src/test/java/org/open/infc/grpc/server/OpenInterfaceGrpcServerTest.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2022 Samsung Electronics + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.open.infc.grpc.server; + +import org.junit.Assert; +import org.junit.Test; + +import java.io.IOException; + +public class OpenInterfaceGrpcServerTest { + + private static final String CONF_FILE = "oclip-grpc-server.properties"; + private static final String CONF_SERVER_PORT = "oclip.grpc_server_port"; + private static final String CONF_SERVER_HOST = "oclip.grpc_server_host"; + + @Test + public void multiInputArgs() throws IOException, InterruptedException{ + String[] args = {"help"}; + OpenInterfaceGrpcServer interfaceGrpcServer = new OpenInterfaceGrpcServer(); + OpenInterfaceGrpcServer.OpenRemoteCli openRemoteCli = new OpenInterfaceGrpcServer.OpenRemoteCli(args); + openRemoteCli.setArgs(args); + Assert.assertEquals("",openRemoteCli.getResult()); + } + + @Test(expected=NullPointerException.class) + public void invalidNullInputArgs() throws IOException, InterruptedException{ + OpenInterfaceGrpcServer interfaceGrpcServer = new OpenInterfaceGrpcServer(); + OpenInterfaceGrpcServer.main(null); + } + + @Test(expected=NumberFormatException.class) + public void invalidInputArgs() throws IOException, InterruptedException{ + String[] args = {"test"}; + OpenInterfaceGrpcServer interfaceGrpcServer = new OpenInterfaceGrpcServer(); + OpenInterfaceGrpcServer.main(args); + } +} -- cgit 1.2.3-korg