Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

OsTest.java 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * SonarQube Runner - API
  3. * Copyright (C) 2011 SonarSource
  4. * dev@sonar.codehaus.org
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
  19. */
  20. package org.sonar.runner.api;
  21. import org.apache.commons.lang.SystemUtils;
  22. import org.junit.Test;
  23. import java.io.File;
  24. import static org.fest.assertions.Assertions.assertThat;
  25. public class OsTest {
  26. @Test
  27. public void testIsWindows() throws Exception {
  28. assertThat(new Os().isWindows()).isEqualTo(SystemUtils.IS_OS_WINDOWS);
  29. }
  30. @Test
  31. public void testUsedJavaHome() throws Exception {
  32. File javaHome = new Os().thisJavaHome();
  33. assertThat(javaHome).isNotNull().exists().isDirectory();
  34. }
  35. @Test
  36. public void testUsedJavaExe() throws Exception {
  37. File javaExe = new Os().thisJavaExe();
  38. assertThat(javaExe).isNotNull().isFile().exists();
  39. assertThat(javaExe.getName()).contains("java");
  40. }
  41. }