@@ -21,7 +21,8 @@ public class LaptopServerTest {
2121 @ Rule
2222 public final GrpcCleanupRule grpcCleanup = new GrpcCleanupRule (); // automatic graceful shutdown channel at the end of test
2323
24- private LaptopStore store ;
24+ private LaptopStore laptopStore ;
25+ private ImageStore imageStore ;
2526 private LaptopServer server ;
2627 private ManagedChannel channel ;
2728
@@ -30,8 +31,9 @@ public void setUp() throws Exception {
3031 String serverName = InProcessServerBuilder .generateName ();
3132 InProcessServerBuilder serverBuilder = InProcessServerBuilder .forName (serverName ).directExecutor ();
3233
33- store = new InMemoryLaptopStore ();
34- server = new LaptopServer (serverBuilder , 0 , store );
34+ laptopStore = new InMemoryLaptopStore ();
35+ imageStore = new DiskImageStore ("tmp" );
36+ server = new LaptopServer (serverBuilder , 0 , laptopStore , imageStore );
3537 server .start ();
3638
3739 channel = grpcCleanup .register (
@@ -55,7 +57,7 @@ public void createLaptopWithAValidID() {
5557 assertNotNull (response );
5658 assertEquals (laptop .getId (), response .getId ());
5759
58- Laptop found = store .Find (response .getId ());
60+ Laptop found = laptopStore .Find (response .getId ());
5961 assertNotNull (found );
6062 }
6163
@@ -70,7 +72,7 @@ public void createLaptopWithAnEmptyID() {
7072 assertNotNull (response );
7173 assertFalse (response .getId ().isEmpty ());
7274
73- Laptop found = store .Find (response .getId ());
75+ Laptop found = laptopStore .Find (response .getId ());
7476 assertNotNull (found );
7577 }
7678
@@ -88,7 +90,7 @@ public void createLaptopWithAnInvalidID() {
8890 public void createLaptopWithAnAlreadyExistsID () throws Exception {
8991 Generator generator = new Generator ();
9092 Laptop laptop = generator .NewLaptop ();
91- store .Save (laptop );
93+ laptopStore .Save (laptop );
9294 CreateLaptopRequest request = CreateLaptopRequest .newBuilder ().setLaptop (laptop ).build ();
9395
9496 LaptopServiceGrpc .LaptopServiceBlockingStub stub = LaptopServiceGrpc .newBlockingStub (channel );
0 commit comments