Package com.google.devtools.moe.client

Source Code of com.google.devtools.moe.client.UiTest

// Copyright 2011 The MOE Authors All Rights Reserved.

package com.google.devtools.moe.client;

import com.google.devtools.moe.client.Ui;
import com.google.devtools.moe.client.testing.AppContextForTesting;

import junit.framework.TestCase;

/**
* @author dbentley@google.com (Daniel Bentley)
*/
public class UiTest extends TestCase {

  class NoOpUi extends Ui {
    public void info(String msg) {}
    public void error(String msg) {}
    public void error(Throwable e, String msg) {}
    public void debug(String msg) {}
  }

  public void testStackHelpers() throws Exception {
    AppContextForTesting.initForTest();
    Ui ui = new NoOpUi();
    Ui.Task t = ui.pushTask("foo", "bar");
    ui.popTask(t, "");
    assertEquals("bar", t.description);

    t = ui.pushTask("foo", "bar");
    try {
      ui.popTask(new Ui.Task("baz", "quux"), "");
      fail("Expected failure");
    } catch (MoeProblem e) {}
  }
}
TOP

Related Classes of com.google.devtools.moe.client.UiTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.