diff --git a/core-java/src/test/resources/original b/core-java/src/test/resources/original new file mode 100644 index 0000000000..cf8c89d389 --- /dev/null +++ b/core-java/src/test/resources/original @@ -0,0 +1,2 @@ +#Copy a File with Java (www.Baeldung.com) +Copying Files with Java is Fun! \ No newline at end of file diff --git a/spring-core/src/main/java/com/baeldung/ditypes/RegisterarConfig.java b/spring-core/src/main/java/com/baeldung/ditypes/RegisterarConfig.java deleted file mode 100644 index c1df1466f3..0000000000 --- a/spring-core/src/main/java/com/baeldung/ditypes/RegisterarConfig.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.ditypes; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ComponentScan("com.baeldung.ditypes") -public class RegisterarConfig { - @Bean - public User user() { - return new User("Alice", 1); - } -} diff --git a/spring-core/src/main/java/com/baeldung/ditypes/Registrar.java b/spring-core/src/main/java/com/baeldung/ditypes/Registrar.java deleted file mode 100644 index 4406151c1b..0000000000 --- a/spring-core/src/main/java/com/baeldung/ditypes/Registrar.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.ditypes; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class Registrar { - private User user; - - @Autowired - public Registrar(User user) { - this.user = user; - } - - public String register() { - return user.register(); - } -} diff --git a/spring-core/src/main/java/com/baeldung/ditypes/User.java b/spring-core/src/main/java/com/baeldung/ditypes/User.java deleted file mode 100644 index b0120c7711..0000000000 --- a/spring-core/src/main/java/com/baeldung/ditypes/User.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.ditypes; - -import org.springframework.stereotype.Component; - -@Component -public class User { - - private String name; - private int id; - - public User(String name, int id) { - this.id = id; - this.name = name; - } - - public String register() { - return "User" + id + ": " + name + " is registered"; - } - -} diff --git a/spring-core/src/test/java/com/baeldung/ditypes/RegisterarTest.java b/spring-core/src/test/java/com/baeldung/ditypes/RegisterarTest.java deleted file mode 100644 index a0aea95a2b..0000000000 --- a/spring-core/src/test/java/com/baeldung/ditypes/RegisterarTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.ditypes; - -import static org.junit.Assert.*; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = RegisterarConfig.class) -public class RegisterarTest { - - @Autowired - private Registrar reg; - - @Autowired - private User user; - - @Test - public void givenAutowiredAnnotation_whenSetOnField_thenRegistrarIsInjected() { - assertNotNull(reg); - } - - @Test - public void givenAutowiredAnnotation_whenSetOnField_thenUserIsInjected() { - assertEquals("User1: Alice is registered", user.register()); - } -}