Search in sources :

Example 1 with OrchidFileController

use of com.eden.orchid.api.server.OrchidFileController in project Orchid by JavaEden.

the class TaskServiceTest method setUp.

@BeforeEach
public void setUp() {
    Set<OrchidTask> tasks = new HashSet<>();
    OrchidTask task1 = mock(OrchidTask.class);
    when(task1.getName()).thenReturn("task1");
    tasks.add(task1);
    OrchidTask task2 = mock(OrchidTask.class);
    when(task2.getName()).thenReturn("task2");
    tasks.add(task2);
    Set<OrchidCommand> commands = new HashSet<>();
    OrchidFileController controller = mock(OrchidFileController.class);
    OrchidServer server = new OrchidServer(new HashSet<>(), controller);
    FileWatcher fileWatcher = mock(FileWatcher.class);
    // test the service directly
    context = mock(OrchidContext.class);
    service = new TaskServiceImpl(tasks, commands, "", 8080, server, fileWatcher);
    service.initialize(context);
    // test that the default implementation is identical to the real implementation
    underTest = new TaskService() {

        public void initialize(OrchidContext context) {
        }

        public <T extends OrchidService> T getService(Class<T> serviceClass) {
            return (T) service;
        }
    };
}
Also used : OrchidContext(com.eden.orchid.api.OrchidContext) OrchidServer(com.eden.orchid.api.server.OrchidServer) FileWatcher(com.eden.orchid.api.server.FileWatcher) OrchidFileController(com.eden.orchid.api.server.OrchidFileController) HashSet(java.util.HashSet) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

OrchidContext (com.eden.orchid.api.OrchidContext)1 FileWatcher (com.eden.orchid.api.server.FileWatcher)1 OrchidFileController (com.eden.orchid.api.server.OrchidFileController)1 OrchidServer (com.eden.orchid.api.server.OrchidServer)1 HashSet (java.util.HashSet)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1