<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gov.hhs.fha.nhinc.direct.xdr;

import gov.hhs.fha.nhinc.direct.DirectBaseTest;
import gov.hhs.fha.nhinc.direct.DirectException;
import ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType;
import ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType.Document;
import javax.xml.ws.WebServiceContext;
import oasis.names.tc.ebxml_regrep.xsd.lcm._3.SubmitObjectsRequest;
import oasis.names.tc.ebxml_regrep.xsd.rs._3.RegistryResponseType;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
 *
 * @author svalluripalli
 */
public class DirectXDRWebServiceImplTest extends DirectBaseTest {
    
    /**
     * Test of provideAndRegisterDocumentSet method, of class DirectXDRWebServiceImpl.
     */
    @Test(expected=DirectException.class)
    public void testProvideAndRegisterDocumentSet_Failure() throws Exception {
        WebServiceContext mockWSContext = mock(WebServiceContext.class);
        DirectHeaderExtractor mockExtractor = mock(DirectHeaderExtractor.class);
        SoapEdgeContext mockSoap = mock(SoapEdgeContext.class);
        ProvideAndRegisterDocumentSetRequestType mockBody = mock(ProvideAndRegisterDocumentSetRequestType.class);
        DirectXDRWebServiceImpl instance = new DirectXDRWebServiceImpl();
        when(mockExtractor.getHeaderProperties(mockWSContext)).thenReturn(mockSoap);
        RegistryResponseType oResponse = instance.provideAndRegisterDocumentSet(mockBody, mockWSContext);
        assertNull(oResponse);
    }
    
    
    /**
     * Test of provideAndRegisterDocumentSet method, of class DirectXDRWebServiceImpl.
     */
    @Test(expected=DirectException.class)
    public void testProvideAndRegisterDocumentSet_Happy() throws Exception {
        WebServiceContext mockWSContext = mock(WebServiceContext.class);
        DirectHeaderExtractor mockExtractor = mock(DirectHeaderExtractor.class);
        SoapEdgeContext mockSoap = mock(SoapEdgeContext.class);
        ProvideAndRegisterDocumentSetRequestType body = new ProvideAndRegisterDocumentSetRequestType();
        Document e = mock(Document.class);
        body.getDocument().add(e);
        SubmitObjectsRequest oSubmit = mock(SubmitObjectsRequest.class);
        body.setSubmitObjectsRequest(oSubmit);
        DirectXDRWebServiceImpl instance = new DirectXDRWebServiceImpl();
        when(mockExtractor.getHeaderProperties(mockWSContext)).thenReturn(mockSoap);
        RegistryResponseType oResponse = instance.provideAndRegisterDocumentSet(body, mockWSContext);
        assertNull(oResponse);
    }
}<commit_msg>CONN-853i: Updated review comments by renaming the method name..<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gov.hhs.fha.nhinc.direct.xdr;

import gov.hhs.fha.nhinc.direct.DirectBaseTest;
import gov.hhs.fha.nhinc.direct.DirectException;
import ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType;
import ihe.iti.xds_b._2007.ProvideAndRegisterDocumentSetRequestType.Document;
import javax.xml.ws.WebServiceContext;
import oasis.names.tc.ebxml_regrep.xsd.lcm._3.SubmitObjectsRequest;
import oasis.names.tc.ebxml_regrep.xsd.rs._3.RegistryResponseType;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
 *
 * @author svalluripalli
 */
public class DirectXDRWebServiceImplTest extends DirectBaseTest {
    
    /**
     * Test of provideAndRegisterDocumentSet method, of class DirectXDRWebServiceImpl.
     */
    @Test(expected=DirectException.class)
    public void testProvideAndRegisterDocumentSet_Failure1() throws Exception {
        WebServiceContext mockWSContext = mock(WebServiceContext.class);
        DirectHeaderExtractor mockExtractor = mock(DirectHeaderExtractor.class);
        SoapEdgeContext mockSoap = mock(SoapEdgeContext.class);
        ProvideAndRegisterDocumentSetRequestType mockBody = mock(ProvideAndRegisterDocumentSetRequestType.class);
        DirectXDRWebServiceImpl instance = new DirectXDRWebServiceImpl();
        when(mockExtractor.getHeaderProperties(mockWSContext)).thenReturn(mockSoap);
        RegistryResponseType oResponse = instance.provideAndRegisterDocumentSet(mockBody, mockWSContext);
        assertNull(oResponse);
    }
    
    
    /**
     * Test of provideAndRegisterDocumentSet method, of class DirectXDRWebServiceImpl.
     */
    @Test(expected=DirectException.class)
    public void testProvideAndRegisterDocumentSet_Failure2() throws Exception {
        WebServiceContext mockWSContext = mock(WebServiceContext.class);
        DirectHeaderExtractor mockExtractor = mock(DirectHeaderExtractor.class);
        SoapEdgeContext mockSoap = mock(SoapEdgeContext.class);
        ProvideAndRegisterDocumentSetRequestType body = new ProvideAndRegisterDocumentSetRequestType();
        Document e = mock(Document.class);
        body.getDocument().add(e);
        SubmitObjectsRequest oSubmit = mock(SubmitObjectsRequest.class);
        body.setSubmitObjectsRequest(oSubmit);
        DirectXDRWebServiceImpl instance = new DirectXDRWebServiceImpl();
        when(mockExtractor.getHeaderProperties(mockWSContext)).thenReturn(mockSoap);
        RegistryResponseType oResponse = instance.provideAndRegisterDocumentSet(body, mockWSContext);
        assertNull(oResponse);
    }
}
{'fraction_non_alphanumeric': 0.08208280600253119, 'fraction_numerical': 0.00451997830410414, 'mean_word_length': 4.703092783505155, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2150273', 'n_tokens_mistral': 1557, 'n_tokens_neox': 1524, 'n_words': 264}