/*******************************************************************************
 * Copyright 2016 Net Wolf UK
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package debrepo.teamcity.entity.helper;

import static org.junit.Assert.*;
import static org.mockito.Mockito.when;

import java.io.File;
import java.io.IOException;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import jetbrains.buildServer.serverSide.ServerPaths;

public class PluginDataResolverImplTest {
	
	@Mock ServerPaths serverPaths;
	File f;
	
	@Before
	public void setup() {
		MockitoAnnotations.initMocks(this);
	}
	
	@Test
	public void testGetPluginDatabaseDirectory() throws IOException {
		f = new File(".BuildServer/pluginData");
		when(serverPaths.getPluginDataDirectory()).thenReturn(f);
		when(serverPaths.getConfigDir()).thenReturn(f.getAbsolutePath());
		PluginDataResolverImpl resolver = new PluginDataResolverImpl(serverPaths);
		System.out.println(resolver.getPluginDatabaseDirectory());
		assertEquals(f.getAbsolutePath() + "/tcDebRepository/database", resolver.getPluginDatabaseDirectory());
	}

	@Test
	public void testGetPluginConfigurationFile() throws IOException {
		f = new File(".BuildServer/config");
		when(serverPaths.getPluginDataDirectory()).thenReturn(f);
		when(serverPaths.getConfigDir()).thenReturn(f.getAbsolutePath());
		PluginDataResolverImpl resolver = new PluginDataResolverImpl(serverPaths);
		System.out.println(resolver.getPluginConfigurationFile());
		assertEquals(f.getAbsolutePath() + "/deb-repositories.xml", resolver.getPluginConfigurationFile());
	}

}

@@ -1121,16 +1121,97 @@
 est %7B%0A%09%0A
+%09private static final String BUILDSERVER_PATH = %22.BuildServer%22 + File.separator;%0A
 %09@Mock S
@@ -1234,16 +1234,16 @@
 rPaths;%0A
-
 %09File f;
@@ -1409,30 +1409,36 @@
 ew File(
-%22.BuildServer/
+BUILDSERVER_PATH + %22
 pluginDa
@@ -1750,26 +1750,63 @@
 ) + 
-%22/tcDebRepository/
+File.separator + %22tcDebRepository%22 + File.separator + %22
 data
@@ -1949,22 +1949,29 @@
 ile(
-%22.BuildServer/
+BUILDSERVER_PATH +  %22
 conf
@@ -2283,10 +2283,26 @@
 ) + 
+File.separator + 
 %22
-/
 deb-

Use File.seperator to make the tests compatible with Windows