Skip to content

Commit

Permalink
Merge pull request #53 from xxx1l/fix
Browse files Browse the repository at this point in the history
增加单元测试用例
  • Loading branch information
FerdinandSu authored Dec 15, 2024
2 parents 838e2d6 + 5898d40 commit 4f60381
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/test/java/ReFreSH/JMobileSuit/IO/IOServerTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,26 @@ public void testSetPrefix() {
assertEquals(1, prefixLengthStack.size());
assertEquals(Integer.valueOf(10), prefixLengthStack.pop());
}
@Test
public void testIOServerConstructorWithSuitConfiguration() {

PromptServer mockPrompt = mock(PromptServer.class);
ColorSetting mockColorSetting = mock(ColorSetting.class);
Logger mockLogger = mock(Logger.class);

SuitConfiguration mockConfig = mock(SuitConfiguration.class);
when(mockConfig.Prompt()).thenReturn(mockPrompt);
when(mockConfig.ColorSetting()).thenReturn(mockColorSetting);
when(mockConfig.Logger()).thenReturn(mockLogger);

IOServer ioserver = new IOServer(mockConfig);

assertEquals(mockPrompt, ioserver.Prompt);
assertEquals(mockColorSetting, ioserver.ColorSetting);
assertEquals(System.in, ioserver.GetInput());
assertEquals(System.out, ioserver.Output);
assertEquals(System.err, ioserver.Error);
}


}

0 comments on commit 4f60381

Please sign in to comment.