/*
* @(#)Playing
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
/**
* 实验7 定义一个接口-Playing,包含有一个抽象方法
* @version 1.0.0.0 Jan 25, 2008
* @author eleven
*/
public interface Playing {
abstract void play(String string);
}
/*
* @(#)Child
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
/**
* 定义一个类Child 实现Playing接口
* @version 1.0.0.0 Jan 25, 2008
* @author eleven
*/
public class Child implements Playing {
public void play(String string) {
//String string = "I am a child and I am playing a game";
System.out.println(string);
}
}
/*
* @(#)Musician
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
/**
* 定义一个类Musician 实现Playing接口
* @version 1.0.0.0 Jan 25, 2008
* @author eleven
*/
public class Musician implements Playing {
public void play(String string) {
//String string = " I am a musician and I am playing a song";
System.out.println(string);
}
}
/*
* @(#)Actor
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
/**
* 定义一个类Actor 实现Playing接口
* @version 1.0.0.0 Jan 25, 2008
* @author eleven
*/
public class Actor implements Playing {
public void play(String string) {
//String string = " I am an actor and I am playing a part";
System.out.println(string);
}
}
/*
* @(#)UsePlaying
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
/**
* 使用其他三个类
* @version 1.0.0.0 Jan 25, 2008
* @author eleven
*/
public class UsePlaying {
public static void main(String[] args) {
Child child = new Child();
Musician musician = new Musician();
Actor actor = new Actor();
child.play("I am a child and I am playing a game");
musician.play("I am a musician and I am playing a song");
actor.play("I am an actor and I am playing a part");
}
}
------------------
测试
/*
* @(#)ActorTest
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* 类Actor测试用例
* @version 1.0.0.0 Jan 27, 2008
* @author eleven
*/
public class ActorTest {
public ActorTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of play method, of class Actor.
*/
@Test
public void play() {
System.out.println("play");
String string = "ActorTest";
Actor instance = new Actor();
instance.play(string);
}
}
/*
* @(#)ChildTest
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* 类Child测试用例
* @version 1.0.0.0 Jan 27, 2008
* @author eleven
*/
public class ChildTest {
public ChildTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of play method, of class Child.
*/
@Test
public void play() {
System.out.println("play");
String string = "ChildTest";
Child instance = new Child();
instance.play(string);
}
}
/*
* @(#)MusicianTest
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* 类Musician测试用例
* @version 1.0.0.0 Jan 27, 2008
* @author eleven
*/
public class MusicianTest {
public MusicianTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of play method, of class Musician.
*/
@Test
public void play() {
System.out.println("play");
String string = "MusicianTest";
Musician instance = new Musician();
instance.play(string);
}
}
/*
* @(#)PlayingTest
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* 接口Playing 测试用例 有问题,待改正
* @version 1.0.0.0 Jan 27, 2008
* @author eleven
*/
public class PlayingTest {
private Playing instance;
public PlayingTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of play method, of class Playing.
*/
@Test
public void play() {
System.out.println("play");
String string = "hello";
//instance.play(string);
}
}
/*
* @(#)UsePlayingTest
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* UsePlaying测试用例
* @version 1.0.0.0 Jan 27, 2008
* @author eleven
*/
public class UsePlayingTest {
public UsePlayingTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of main method, of class UsePlaying.
*/
@Test
public void main() {
System.out.println("main");
String[] args = null;
UsePlaying.main(args);
}
}
* @(#)Playing
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
/**
* 实验7 定义一个接口-Playing,包含有一个抽象方法
* @version 1.0.0.0 Jan 25, 2008
* @author eleven
*/
public interface Playing {
abstract void play(String string);
}
/*
* @(#)Child
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
/**
* 定义一个类Child 实现Playing接口
* @version 1.0.0.0 Jan 25, 2008
* @author eleven
*/
public class Child implements Playing {
public void play(String string) {
//String string = "I am a child and I am playing a game";
System.out.println(string);
}
}
/*
* @(#)Musician
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
/**
* 定义一个类Musician 实现Playing接口
* @version 1.0.0.0 Jan 25, 2008
* @author eleven
*/
public class Musician implements Playing {
public void play(String string) {
//String string = " I am a musician and I am playing a song";
System.out.println(string);
}
}
/*
* @(#)Actor
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
/**
* 定义一个类Actor 实现Playing接口
* @version 1.0.0.0 Jan 25, 2008
* @author eleven
*/
public class Actor implements Playing {
public void play(String string) {
//String string = " I am an actor and I am playing a part";
System.out.println(string);
}
}
/*
* @(#)UsePlaying
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
/**
* 使用其他三个类
* @version 1.0.0.0 Jan 25, 2008
* @author eleven
*/
public class UsePlaying {
public static void main(String[] args) {
Child child = new Child();
Musician musician = new Musician();
Actor actor = new Actor();
child.play("I am a child and I am playing a game");
musician.play("I am a musician and I am playing a song");
actor.play("I am an actor and I am playing a part");
}
}
------------------
测试
/*
* @(#)ActorTest
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* 类Actor测试用例
* @version 1.0.0.0 Jan 27, 2008
* @author eleven
*/
public class ActorTest {
public ActorTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of play method, of class Actor.
*/
@Test
public void play() {
System.out.println("play");
String string = "ActorTest";
Actor instance = new Actor();
instance.play(string);
}
}
/*
* @(#)ChildTest
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* 类Child测试用例
* @version 1.0.0.0 Jan 27, 2008
* @author eleven
*/
public class ChildTest {
public ChildTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of play method, of class Child.
*/
@Test
public void play() {
System.out.println("play");
String string = "ChildTest";
Child instance = new Child();
instance.play(string);
}
}
/*
* @(#)MusicianTest
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* 类Musician测试用例
* @version 1.0.0.0 Jan 27, 2008
* @author eleven
*/
public class MusicianTest {
public MusicianTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of play method, of class Musician.
*/
@Test
public void play() {
System.out.println("play");
String string = "MusicianTest";
Musician instance = new Musician();
instance.play(string);
}
}
/*
* @(#)PlayingTest
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* 接口Playing 测试用例 有问题,待改正
* @version 1.0.0.0 Jan 27, 2008
* @author eleven
*/
public class PlayingTest {
private Playing instance;
public PlayingTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of play method, of class Playing.
*/
@Test
public void play() {
System.out.println("play");
String string = "hello";
//instance.play(string);
}
}
/*
* @(#)UsePlayingTest
*
* Copyright 2008 School of Software, Yunnan University.
* All rights reserved
*/
package cn.edu.ynu.sei.Java_Labs.Lab7;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* UsePlaying测试用例
* @version 1.0.0.0 Jan 27, 2008
* @author eleven
*/
public class UsePlayingTest {
public UsePlayingTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of main method, of class UsePlaying.
*/
@Test
public void main() {
System.out.println("main");
String[] args = null;
UsePlaying.main(args);
}
}