move article files to new module

This commit is contained in:
Ssam
2022-11-20 12:15:45 +00:00
parent 0107dc4d11
commit 3c57c4d566
7 changed files with 2 additions and 87 deletions
@@ -1,19 +0,0 @@
package com.baeldung.resource;
import java.net.URL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ClassGetResourceExample {
private static Logger logger = LoggerFactory.getLogger(ClassGetResourceExample.class);
public static void main(String[] args) {
URL resourceAbsolutePath = ClassGetResourceExample.class.getResource("/com/baeldung/resource/example.txt");
logger.info("Resource with absolute path = {}", resourceAbsolutePath);
URL resourceRelativePath = ClassGetResourceExample.class.getResource("example.txt");
logger.info("Resource with relative path = {}", resourceRelativePath);
}
}
@@ -1,21 +0,0 @@
package com.baeldung.resource;
import java.net.URL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ClassLoaderGetResourceExample {
private static Logger logger = LoggerFactory.getLogger(ClassLoaderGetResourceExample.class);
public static void main(String[] args) {
URL resourceAbsolutePath = ClassLoaderGetResourceExample.class.getClassLoader()
.getResource("com/baeldung/resource/example.txt");
logger.info("Resource with absolute path = {}", resourceAbsolutePath);
URL resourceRelativePath = ClassLoaderGetResourceExample.class.getClassLoader()
.getResource("example.txt");
logger.info("Resource with relative path = {}", resourceRelativePath);
}
}
@@ -1,21 +0,0 @@
package com.baeldung.resource;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.net.URL;
class ClassGetResourceUnitTest {
@Test
void givenRelativeResourcePath_whenGetResource_thenReturnResource() {
URL resourceRelativePath = ClassGetResourceExample.class.getResource("example.txt");
Assertions.assertNotNull(resourceRelativePath);
}
@Test
void givenAbsoluteResourcePath_whenGetResource_thenReturnResource() {
URL resourceAbsolutePath = ClassGetResourceExample.class.getResource("/com/baeldung/resource/example.txt");
Assertions.assertNotNull(resourceAbsolutePath);
}
}
@@ -1,23 +0,0 @@
package com.baeldung.resource;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.net.URL;
class ClassLoaderGetResourceUnitTest {
@Test
void givenRelativeResourcePath_whenGetResource_thenReturnNull() {
URL resourceRelativePath = ClassLoaderGetResourceExample.class.getClassLoader()
.getResource("example.txt");
Assertions.assertNull(resourceRelativePath);
}
@Test
void givenAbsoluteResourcePath_whenGetResource_thenReturnResource() {
URL resourceAbsolutePath = ClassLoaderGetResourceExample.class.getClassLoader()
.getResource("com/baeldung/resource/example.txt");
Assertions.assertNotNull(resourceAbsolutePath);
}
}