package com.salcedo.rapbot.motor;

import akka.actor.ActorSystem;
import akka.http.javadsl.Http;
import akka.http.javadsl.model.Uri;
import akka.stream.ActorMaterializer;
import com.google.gson.GsonBuilder;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.util.concurrent.TimeUnit;

public class HttpMotorServiceTest {
    private MotorService service;
    private ActorSystem system;

    @Before
    public void setUp() {
        system = ActorSystem.create("Test");
        service = new HttpMotorService(
                Http.get(system),
                ActorMaterializer.create(system),
                Uri.create("http://192.168.1.41:3000/motors"),
                new GsonBuilder().create()
        );
    }

    @After
    public void tearDown() {
        system.terminate();
    }

    @Test
    public void drive() throws Exception {
        service.drive(createRequest(255)).toCompletableFuture().get(1L, TimeUnit.SECONDS);
        service.drive(createRequest(0)).toCompletableFuture().get(1L, TimeUnit.SECONDS);
    }

    private MotorRequest createRequest(int speed) {
        Motor backLeftMotor = Motor.builder()
                .withBackLeftLocation()
                .withForwardCommand()
                .withSpeed(speed)
                .build();
        Motor backRightMotor = Motor.builder()
                .withBackRightLocation()
                .withForwardCommand()
                .withSpeed(speed)
                .build();

        return MotorRequest.builder()
                .addMotor(backLeftMotor)
                .addMotor(backRightMotor)
                .build();
    }
}
@@ -273,16 +273,64 @@
 .Test;%0A%0A
+import java.util.concurrent.ExecutionException;%0A
 import j
@@ -878,16 +878,53 @@
    @Test
+(expected = ExecutionException.class)
 %0A    pub

Add expected to make tests buildable. Using tests as a locally run integration test.