Search in sources :

Example 1 with GCViewerGuiController

use of com.tagtraum.perf.gcviewer.ctrl.impl.GCViewerGuiController in project GCViewer by chewiebug.

the class GCViewerTest method singleArgumentOpensGui.

@Test
public void singleArgumentOpensGui() throws Exception {
    GCViewerGuiController controller = mock(GCViewerGuiController.class);
    GCViewer gcViewer = new GCViewer(controller, new GCViewerArgsParser());
    String[] args = { "some_gc.log" };
    gcViewer.doMain(args);
    verify(controller).startGui(new GcResourceFile("some_gc.log"));
    assertThat(outContent.toString(), isEmptyString());
    assertThat(errContent.toString(), isEmptyString());
}
Also used : Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) Matchers.containsString(org.hamcrest.Matchers.containsString) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GCViewerGuiController(com.tagtraum.perf.gcviewer.ctrl.impl.GCViewerGuiController) Test(org.junit.Test)

Example 2 with GCViewerGuiController

use of com.tagtraum.perf.gcviewer.ctrl.impl.GCViewerGuiController in project GCViewer by chewiebug.

the class GCViewerTest method moreThan3ArgumentsPrintsUsage.

@Test
public void moreThan3ArgumentsPrintsUsage() throws Exception {
    GCViewerGuiController controller = mock(GCViewerGuiController.class);
    GCViewer gcViewer = new GCViewer(controller, new GCViewerArgsParser());
    String[] args = { "argument1", "argument2", "argument3", "argument4" };
    gcViewer.doMain(args);
    verify(controller, never()).startGui(any(GCResource.class));
    assertThat(outContent.toString(), containsString("Welcome to GCViewer with cmdline"));
    assertThat(errContent.toString(), isEmptyString());
}
Also used : GCResource(com.tagtraum.perf.gcviewer.model.GCResource) Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) Matchers.containsString(org.hamcrest.Matchers.containsString) GCViewerGuiController(com.tagtraum.perf.gcviewer.ctrl.impl.GCViewerGuiController) Test(org.junit.Test)

Example 3 with GCViewerGuiController

use of com.tagtraum.perf.gcviewer.ctrl.impl.GCViewerGuiController in project GCViewer by chewiebug.

the class GCViewerTest method singleArgumentWithSeriesOpensGui.

@Test
public void singleArgumentWithSeriesOpensGui() throws Exception {
    GCViewerGuiController controller = mock(GCViewerGuiController.class);
    GCViewer gcViewer = new GCViewer(controller, new GCViewerArgsParser());
    String[] args = { "some_gc.log.0;some_gc.log.1;some_gc.log.2" };
    gcViewer.doMain(args);
    verify(controller).startGui(new GcResourceSeries(Arrays.asList(new GcResourceFile("some_gc.log.0"), new GcResourceFile("some_gc.log.1"), new GcResourceFile("some_gc.log.2"))));
    assertThat(outContent.toString(), isEmptyString());
    assertThat(errContent.toString(), isEmptyString());
}
Also used : Matchers.isEmptyString(org.hamcrest.Matchers.isEmptyString) Matchers.containsString(org.hamcrest.Matchers.containsString) GcResourceFile(com.tagtraum.perf.gcviewer.model.GcResourceFile) GcResourceSeries(com.tagtraum.perf.gcviewer.model.GcResourceSeries) GCViewerGuiController(com.tagtraum.perf.gcviewer.ctrl.impl.GCViewerGuiController) Test(org.junit.Test)

Aggregations

GCViewerGuiController (com.tagtraum.perf.gcviewer.ctrl.impl.GCViewerGuiController)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 Matchers.isEmptyString (org.hamcrest.Matchers.isEmptyString)3 Test (org.junit.Test)3 GcResourceFile (com.tagtraum.perf.gcviewer.model.GcResourceFile)2 GCResource (com.tagtraum.perf.gcviewer.model.GCResource)1 GcResourceSeries (com.tagtraum.perf.gcviewer.model.GcResourceSeries)1