/home/wpollock1/public_html/AJava/DIManual/InjectedControllerTest.java
package com.wpollock.manualdidemo;
import static org.junit.jupiter.api.Assertions.*;
class InjectedControllerTest {
private static PropInjectedController pic;
private static SetterInjectedController sic;
private static ConstructorInjectedController cic;
@org.junit.jupiter.api.BeforeAll
static void setUp() {
final GreetingServiceImpl gsi = new GreetingServiceImpl();
pic = new PropInjectedController();
pic.greetingService = gsi; // Property Injection
sic = new SetterInjectedController();
sic.setGreetingService( gsi ); // Setter Injection
cic = new ConstructorInjectedController( gsi); // Ctor Injection
}
@org.junit.jupiter.api.Test
void testPropertyInjectedSayHello() {
System.out.print("Testing Property Injection: ");
pic.sayHello();
}
@org.junit.jupiter.api.Test
void testSetterInjectedSayHello() {
System.out.print("Testing Setter Injection: ");
sic.sayHello();
}
@org.junit.jupiter.api.Test
void testConstructorInjectedSayHello() {
System.out.print("Testing Constructor Injection: ");
cic.sayHello();
}
}