testshapefactory.java
来自「著名的uncle Bob的Agile software development的」· Java 代码 · 共 38 行
JAVA
38 行
import junit.framework.TestCase;
import junit.swingui.TestRunner;
public class TestShapeFactory extends TestCase
{
public static void main(String[] args)
{
TestRunner.main(new String[]{"TestShapeFactory"});
}
public TestShapeFactory(String name)
{
super(name);
}
private ShapeFactory factory;
public void setUp() throws Exception
{
factory = new ShapeFactoryImplementation();
}
public void tearDown() throws Exception
{
}
public void testCreateCircle() throws Exception
{
Shape s = factory.makeCircle();
assertEquals("Circle", s.getShapeType());
}
public void testCreateSquare() throws Exception
{
Shape s = factory.makeSquare();
assertEquals("Square", s.getShapeType());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?