Search in sources :

Example 1 with TextDiffResponse

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);
}
Also used : TextDiffResponse(com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse) File(com.google.startupos.common.repo.Protos.File) Test(org.junit.Test)

Example 2 with TextDiffResponse

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);
}
Also used : TextDiffResponse(com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse) File(com.google.startupos.common.repo.Protos.File) Test(org.junit.Test)

Example 3 with TextDiffResponse

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);
}
Also used : TextDiffResponse(com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse) File(com.google.startupos.common.repo.Protos.File) Test(org.junit.Test)

Example 4 with TextDiffResponse

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);
}
Also used : TextDiffResponse(com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse) File(com.google.startupos.common.repo.Protos.File) Test(org.junit.Test)

Example 5 with TextDiffResponse

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);
}
Also used : TextDiffResponse(com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse) File(com.google.startupos.common.repo.Protos.File) Test(org.junit.Test)

Aggregations

File (com.google.startupos.common.repo.Protos.File)9 TextDiffResponse (com.google.startupos.tools.reviewer.local_server.service.Protos.TextDiffResponse)9 Test (org.junit.Test)9