+
+ @Test
+ public void testEscapeUtilsNull() throws Exception {
+ String str = null;
+ assertNull(EscapeUtils.escapeSql(str));
+ }
+
+ @Test
+ public void testDummyData() throws IOException {
+ String artifactContent = IOUtils.toString(ArtifactHandlerProviderUtilTest.class.getClassLoader()
+ .getResourceAsStream("templates/reference_template.json"), Charset.defaultCharset());
+ ArtifactHandlerProviderUtil ahprovider = Mockito.spy(new ArtifactHandlerProviderUtil());
+ UploadartifactInputBuilder builder = new UploadartifactInputBuilder();
+ DocumentParameters mockDocumentParameters = Mockito.mock(DocumentParameters.class);
+ Mockito.doReturn(artifactContent).when(mockDocumentParameters).getArtifactContents();
+ Mockito.doReturn("ARTIFACT NAME").when(mockDocumentParameters).getArtifactName();
+ builder.setDocumentParameters(mockDocumentParameters);
+ RequestInformation mockRequestInformation = Mockito.mock(RequestInformation.class);
+ Mockito.doReturn("REQUEST ID").when(mockRequestInformation).getRequestId();
+ Mockito.doReturn(SdcArtifactHandlerConstants.DESIGN_TOOL).when(mockRequestInformation).getSource();
+ builder.setRequestInformation(mockRequestInformation);
+ UploadartifactInput uploadArtifactInput = builder.build();
+ Whitebox.setInternalState(ahprovider, "templateData", uploadArtifactInput);
+ assertTrue(ahprovider.createDummyRequestData().startsWith("{\"input\": {\"document-parameters\":{\"service-uuid\":\"TLSUUIDREQUEST ID\""));
+ }
+
+ @Test
+ public void testRequestData() throws IOException {
+ String artifactContent = IOUtils.toString(ArtifactHandlerProviderUtilTest.class.getClassLoader()
+ .getResourceAsStream("templates/reference_template.json"), Charset.defaultCharset());
+ ArtifactHandlerProviderUtil ahprovider = Mockito.spy(new ArtifactHandlerProviderUtil());
+ UploadartifactInputBuilder builder = new UploadartifactInputBuilder();
+ DocumentParameters mockDocumentParameters = Mockito.mock(DocumentParameters.class);
+ Mockito.doReturn(artifactContent).when(mockDocumentParameters).getArtifactContents();
+ Mockito.doReturn("ARTIFACT NAME").when(mockDocumentParameters).getArtifactName();
+ builder.setDocumentParameters(mockDocumentParameters);
+ RequestInformation mockRequestInformation = Mockito.mock(RequestInformation.class);
+ Mockito.doReturn("REQUEST ID").when(mockRequestInformation).getRequestId();
+ Mockito.doReturn(SdcArtifactHandlerConstants.DESIGN_TOOL).when(mockRequestInformation).getSource();
+ builder.setRequestInformation(mockRequestInformation);
+ UploadartifactInput uploadArtifactInput = builder.build();
+ Whitebox.setInternalState(ahprovider, "templateData", uploadArtifactInput);
+ assertTrue(ahprovider.createDummyRequestData().startsWith("{\"input\": {\"document-parameters\":{\"service-uuid\":\"TLSUUIDREQUEST ID\""));
+ }