Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 6847ea5

Browse files
author
Aleksi Salmela
committed
Add unit test for the new code in paste.
1 parent 74fdd71 commit 6847ea5

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/main/java/fi/helsinki/cs/tmc/cli/command/PasteCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void run(CliContext context, CommandLine args) {
4949
this.io = ctx.getIo();
5050
WorkDir workdir = ctx.getWorkDir();
5151

52-
if(!parseArgs(args)) {
52+
if (!parseArgs(args)) {
5353
return;
5454
}
5555

src/test/java/fi/helsinki/cs/tmc/cli/command/PasteCommandTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ public void failIfCoreIsNull() {
105105
io.assertNotContains("No exercise specified");
106106
}
107107

108+
@Test
109+
public void setMessageAndNoMessageOption() {
110+
ctx = spy(new CliContext(io, mockCore, workDir));
111+
app = new Application(ctx);
112+
doReturn(false).when(ctx).loadBackend();
113+
114+
String[] args = {"paste", "-m", "Message", "-n"};
115+
app.run(args);
116+
io.assertContains("You can't have the no-message flag and message set");
117+
}
118+
108119
@Test
109120
public void pasteRunsRightWithoutArguments() throws URISyntaxException {
110121
when(TmcUtil.sendPaste(eq(ctx), any(Exercise.class), anyString()))

0 commit comments

Comments
 (0)