move article files to new module

This commit is contained in:
Ssam
2022-11-20 12:15:45 +00:00
parent 72ce30d7f4
commit 562d2c9e88
7 changed files with 2 additions and 87 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}