@Test(expected = UnsupportedOperationException.class)
public void testPublishTemplate_ExistingTemplate_OverwriteFalse() throws Exception {

    ExportTemplate template = new ExportTemplate("testFile", "testTemplate", "testDesc", false, new byte[0]);
    TemplateMetadata existingTemplate = new TemplateMetadata("testTemplate", "testDesc", "xyz.zip", false);
    List<TemplateMetadataWrapper> templates = new ArrayList<>();
    templates.add(new TemplateMetadataWrapper(existingTemplate));
    when(templateExporter.exportTemplate(anyString())).thenReturn(template);
    FilesystemRepositoryService spy = PowerMockito.spy(filesystemRepositoryService);
    doReturn(repository).when(spy, "getRepositoryByNameAndType", anyString(), anyString());
    doReturn(templates).when(spy, "listTemplatesByRepository", repository);
    spy.publishTemplate("test", "test", "test",false);
    PowerMockito.verifyStatic(never());
    FilenameUtils.getBaseName(anyString());
}