use of com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse in project startup-os by google.
the class CodeReviewServiceTextDiffTest method copiedWorkspaceExistsPreviouslyCommitted.
// COPY, locally modified, workspace exists, previously committed
@Test
public void copiedWorkspaceExistsPreviouslyCommitted() {
writeFile("copied.txt", TEST_FILE_CONTENTS);
File file = File.newBuilder().setRepoId("startup-os").setWorkspace(TEST_WORKSPACE).setFilename("copied.txt").build();
TextDiffResponse response = getResponse(file);
assertEquals(getExpectedResponse(TEST_FILE_CONTENTS), response);
}
use of com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse in project startup-os by google.
the class CodeReviewServiceTextDiffTest method testTextDiff_locallyModifiedWorkspaceNotExistsNewFile.
// ADD, locally modified, workspace doesn't exist, new file
@Test(expected = StatusRuntimeException.class)
public void testTextDiff_locallyModifiedWorkspaceNotExistsNewFile() {
writeFile("somefile.txt", TEST_FILE_CONTENTS);
writeFile(TEST_FILE_CONTENTS);
File file = File.newBuilder().setRepoId("startup-os").setWorkspace("non-existing-workspace").setFilename("somefile.txt").build();
TextDiffResponse response = getResponse(file);
}
use of com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse in project startup-os by google.
the class CodeReviewServiceTextDiffTest method renamedWorkspaceExistsPreviouslyCommitted.
// RENAME, locally modified, workspace exists, previously committed
@Test
public void renamedWorkspaceExistsPreviouslyCommitted() {
writeFile("renamed.txt", TEST_FILE_CONTENTS);
deleteFile(TEST_FILE);
File file = File.newBuilder().setRepoId("startup-os").setWorkspace(TEST_WORKSPACE).setFilename("renamed.txt").build();
TextDiffResponse response = getResponse(file);
assertEquals(getExpectedResponse(TEST_FILE_CONTENTS), response);
}
use of com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse in project startup-os by google.
the class CodeReviewServiceTextDiffTest method testTextDiff_locallyModifiedWorkspaceExistsPreviouslyCommitted.
// MODIFY, locally modified, workspace exists, previously committed
@Test
public void testTextDiff_locallyModifiedWorkspaceExistsPreviouslyCommitted() {
writeFile("Some changes");
File file = File.newBuilder().setRepoId("startup-os").setWorkspace(TEST_WORKSPACE).setFilename(TEST_FILE).build();
TextDiffResponse response = getResponse(file);
assertEquals(getExpectedResponse("Some changes"), response);
}
use of com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse in project startup-os by google.
the class CodeReviewServiceTextDiffTest method testTextDiff_deletedFile.
// DELETE, any file
@Test
public void testTextDiff_deletedFile() {
File file = File.newBuilder().setRepoId("startup-os").setWorkspace(TEST_WORKSPACE).setFilename(TEST_FILE).setAction(Action.DELETE).build();
TextDiffResponse response = getResponse(file);
assertEquals(getExpectedResponse(""), response);
}
Aggregations