*/
package org.sonar.api.utils;
-import org.apache.commons.lang.SystemUtils;
-import org.sonar.api.batch.BatchSide;
-import org.sonar.api.server.ServerSide;
-
-import javax.annotation.CheckForNull;
-
+import java.net.URL;
import java.util.Date;
import java.util.Map;
import java.util.Properties;
import java.util.TimeZone;
+import javax.annotation.CheckForNull;
+import org.apache.commons.lang.SystemUtils;
+import org.sonar.api.batch.BatchSide;
+import org.sonar.api.server.ServerSide;
/**
* Proxy over {@link java.lang.System}. It aims to improve testability of classes
return TimeZone.getDefault();
}
+ /**
+ * @since 5.5
+ * @see Class#getResource(String)
+ */
+ public URL getResource(String name) {
+ return getClass().getResource(name);
+ }
+
/**
* Closes the object and throws an {@link java.lang.IllegalStateException} on error.
* @since 5.1
System2.INSTANCE.println("foo");
}
+ @Test
+ public void testGetResource() throws Exception {
+ String name = "META-INF/MANIFEST.MF";
+ assertThat(System2.INSTANCE.getResource(name)).isEqualTo(getClass().getResource(name));
+ }
+
@Test
public void close() {
class MyCloseable implements Closeable {