Personal project-book Management system landing function simulation

Source: Internet
Author: User

I. Introduction of the topic

It is assumed that there are two kinds of users, librarians and readers in the library management system, and the readers are divided into teacher readers and student readers. All users are logged on to the system before they can use various features. When you log in, you need to provide the user's account and password information. In addition, for different users, after successful login display different welcome information (including the user's name, identity, etc.). Please simulate the login function of the library management system according to the above requirements.

Second, the source of GitHub links

Https://github.com/bbker/library

Third, the design of the module test cases, test results

Package newlibrary;

Import static org.junit.assert.*;

Import Org.junit.After;
Import Org.junit.Before;
Import Org.junit.Test;

public class Testtest {

@Before
public void SetUp () throws Exception {
}

@After
public void TearDown () throws Exception {
}

@Test
public void Test () {
Administration A=new Administration ("Zhang", 123456);
Assertequals (A.name, "Zhang");
Assertequals (A.password, 123456);
Assertequals (a.who (), "Zhang San Administrator");
Student s=new Student ("Wangwu", 333333);
Assertequals (S.name, "Wangwu");
Assertequals (S.password, 333333);
Assertequals (s.who (), "Harry classmate");
Teacher t=new Teacher ("Lisi", 999999);
Assertequals (T.name, "Lisi");
Assertequals (T.password, 999999);
Assertequals (t.who (), "John Doe Teacher");
}

}

Test run:

1. Enter the correct test results

2. Input Error test results

Iv. problems and solutions, experience

The inheritance relationship of this program class:

The user class is the parent class of the reader class, the administration class, and the reader class is the parent class of the teacher class and the student class.

Administration, Reader class inherits the member variable of user, abstract method login ().

The Teacher, student class inherits the member variable of user, overwriting the reader class login, who method.

The first use of unit testing tools, in our team blog Www.cnblogs.com/bbkers published a little about the current mainstream testing unit testing tools, self-teaching through the teacher and online learning has initially mastered a little junit4 knowledge, and applied to this program, The shortcomings are also invited to advise the Netizen.

Personal project-book Management system landing function simulation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.