/** * <em> Remove consecutive spaces from an input string </em> * * <pre> * Input Data: * >Set INSTRING=”Multiple spaces in middle of string” * * Procedure Call: * * > D MAXBLANK^XMWSOA07(.DATA,INSTRING) * * Expected Output: * * >ZW DATA * DATA="Multiple spaces in middle of string" * </pre> * * @throws VistaWebServiceFault */ @Test public void testRemoveConsecutiveSpaces() throws VistaWebServiceFault { String expectedResult = "Multiple spaces in middle of string"; when(this.getVistaLinkContext().makeRPCCall(new RPCIdentifier(""), null)) .thenReturn(expectedResult); request.setInput("Multiple spaces in middle of string"); XMXUtil1MaxBlankResponse response = service.maxBlank(request); assertNotNull(response); assertEquals(expectedResult, response.getCorrectedResult()); }
/** * <em>Empty string passed into the function returns an error </em> * * <pre> * Input Data: * >Set INSTRING=”” * * Procedure Call: * * > D MAXBLANK^XMWSOA07(.DATA,INSTRING) * * Expected Output: * * >ZW DATA * DATA="-1^Error in required input" * </pre> * * @throws VistaWebServiceFault */ @Test public void testEmptyString() throws VistaWebServiceFault { String expectedResult = "-1^Error in required input"; when(this.getVistaLinkContext().makeRPCCall(new RPCIdentifier(""), null)) .thenReturn(expectedResult); request.setInput(""); XMXUtil1MaxBlankResponse response = service.maxBlank(request); assertNotNull(response); assertNull(response.getCorrectedResult()); assertNotNull(response.getErrors()); assertEquals(expectedResult.split("\\^")[0], response.getStatus()); assertEquals(expectedResult.split("\\^")[1], response.getErrors().get(0)); }