db.prepareDbUnit(getClass(), "last_snapshot.xml");
ServerClient server = mock(ServerClient.class);
when(server.request(anyString(), eq("GET"), eq(false), eq(30 * 1000))).thenThrow(new HttpDownloader.HttpException(new URI(""), 404));
when(mode.isPreview()).thenReturn(true);
LastSnapshots lastSnapshots = new LastSnapshots(mode, new SnapshotSourceDao(db.myBatis()), server);
String source = lastSnapshots.getSource(newFileWithSpace());
assertThat(source).isEqualTo("");
verify(server).request("/api/sources/raw?key=myproject%3Aorg%2Ffoo%2FFoo+Bar.c", "GET", false, 30 * 1000);
}