/*
 * Copyright 2000-2016 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * See LICENSE in the project root for license information.
 */

package jetbrains.buildServer.dnx.test;

import jetbrains.buildServer.agent.ToolProvider;
import jetbrains.buildServer.agent.impl.ToolProvidersRegistryImpl;
import jetbrains.buildServer.dnx.DnxToolProvider;
import org.testng.Assert;
import org.testng.annotations.Test;

/**
 * @author Dmitry.Tretyakov
 *         Date: 1/15/2016
 *         Time: 12:50 AM
 */
public class DnxToolProviderTest {

    @Test
    public void testGetPath() throws Exception {
        final ToolProvider toolProvider = new DnxToolProvider(new ToolProvidersRegistryImpl());
        final String dnuPath = toolProvider.getPath("dnu");

        System.out.print(dnuPath);

        Assert.assertNotNull(dnuPath);
    }

    @Test
    public void testSupport() throws Exception {
        final ToolProvider toolProvider = new DnxToolProvider(new ToolProvidersRegistryImpl());
        Assert.assertTrue(toolProvider.supports("dnu"));
    }
}
@@ -212,16 +212,79 @@
 .test;%0A%0A
+import jetbrains.buildServer.agent.ToolCannotBeFoundException;%0A
 import j
@@ -504,16 +504,38 @@
 .Test;%0A%0A
+import java.io.File;%0A%0A
 /**%0A * @
@@ -690,33 +690,16 @@
 etPath()
- throws Exception
  %7B%0A     
@@ -801,135 +801,670 @@
     
-final String dnuPath = toolProvider.getPath(%22dnu%22);%0A%0A        System.out.print(dnuPath);%0A%0A        Assert.assertNotNull(dnuPath);
+String dnuPath = null;%0A        ToolCannotBeFoundException exception = null;%0A%0A        try %7B%0A            dnuPath = toolProvider.getPath(%22dnu%22);%0A        %7D catch (ToolCannotBeFoundException e) %7B%0A            exception = e;%0A        %7D%0A%0A        final String userHome = System.getProperty(%22user.home%22);%0A        final File dnxDirectory = new File(userHome, %22.dnx%22);%0A%0A        if (dnxDirectory.exists())%7B%0A            Assert.assertNotNull(dnuPath, %22DNU path should not be null%22);%0A            Assert.assertTrue(new File(dnuPath).exists(), %22DNU should exists%22);%0A        %7D else %7B%0A            Assert.assertNotNull(exception, %22Should be thrown dnu not found exception%22);%0A        %7D
 %0A   

Fix assertion in dnu discovery test