diff options
Diffstat (limited to 'netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationServiceTest.java')
-rw-r--r-- | netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationServiceTest.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationServiceTest.java b/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationServiceTest.java index 6da6572..f42ad84 100644 --- a/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationServiceTest.java +++ b/netconfsimulator/src/test/java/org/onap/netconfsimulator/netconfcore/configuration/NetconfConfigurationServiceTest.java @@ -28,8 +28,10 @@ import static org.mockito.MockitoAnnotations.initMocks; import com.tailf.jnc.Element; import com.tailf.jnc.JNCException; + import java.io.IOException; import java.nio.file.Files; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; @@ -49,11 +51,11 @@ class NetconfConfigurationServiceTest { @InjectMocks NetconfConfigurationService service; - private static String CURRENT_CONFIG_XML_STRING = - "<config xmlns=\"http://onap.org/pnf-simulator\" xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" - + " <itemValue1>100</itemValue1>\n" - + " <itemValue2>200</itemValue2>\n" - + "</config>\n"; + private static String CURRENT_CONFIG_XML_STRING = + "<config xmlns=\"http://onap.org/pnf-simulator\" xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n" + + " <itemValue1>100</itemValue1>\n" + + " <itemValue2>200</itemValue2>\n" + + "</config>\n"; @BeforeEach void setUp() { @@ -71,16 +73,16 @@ class NetconfConfigurationServiceTest { } @Test - void testShouldThrowExceptionWhenCurrentConfigurationDoesNotExists() throws IOException, JNCException{ + void testShouldThrowExceptionWhenCurrentConfigurationDoesNotExists() throws IOException, JNCException { when(reader.getRunningConfig()).thenThrow(JNCException.class); assertThatThrownBy(() -> service.getCurrentConfiguration()).isInstanceOf(JNCException.class); } @Test - void testShouldEditConfigurationSuccessfully() throws IOException, JNCException{ + void testShouldEditConfigurationSuccessfully() throws IOException, JNCException { byte[] bytes = - Files.readAllBytes(ResourceUtils.getFile("classpath:updatedConfig.xml").toPath()); + Files.readAllBytes(ResourceUtils.getFile("classpath:updatedConfig.xml").toPath()); MockMultipartFile editConfigXmlContent = new MockMultipartFile("editConfigXml", bytes); ArgumentCaptor<Element> elementCaptor = ArgumentCaptor.forClass(Element.class); doNothing().when(editor).editConfig(elementCaptor.capture()); @@ -93,7 +95,7 @@ class NetconfConfigurationServiceTest { @Test void testShouldRaiseExceptionWhenMultipartFileIsInvalidXmlFile() throws IOException { byte[] bytes = - Files.readAllBytes(ResourceUtils.getFile("classpath:invalidXmlFile.xml").toPath()); + Files.readAllBytes(ResourceUtils.getFile("classpath:invalidXmlFile.xml").toPath()); MockMultipartFile editConfigXmlContent = new MockMultipartFile("editConfigXml", bytes); assertThatThrownBy(() -> service.editCurrentConfiguration(editConfigXmlContent)).isInstanceOf(JNCException.class); |