#### Foreword Recently saw some videos in moOCs network, ready to start from 0 to do an e-commerce website. The IDE of Java used by Daniel in the video is IDEA, which makes me confused. From AS to MyEclipse, I finally got a little familiar with the basic operation of MyEclipse. Now I need to change IDEA. The tool required by the company is Eclipse. This gave me a headache. Fortunately, as and IDEA were the same when I was working on Android, and the operation was basically the same, so I started the journey of IDEA introduction. (I always thought IDEA was imitating AS, but later I learned that AS was modified on the community version based on IDEA)

#### Lombok Plug-ins Lombok plug-ins are really handy, simplifying bloated code and making it simpler.

  • Open the File – Setting – the Plugins

  • Click Browse Repositories, search Lombok, and download the plug-in. Remember to restart IDEA, this is the screenshot I have installed.

  • Remember to add Lombok’s dependencies to POM.xml

<dependencies> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> The < version > 1.16.2 < / version > < / dependency > < / dependencies >Copy the code

####Junit Generator2 plugin: of course, it is convenient for our unit testing, one click in the test directory to generate the test class we want, simple and convenient.

  • Go to file-setting-plugins and search for the Junit Generator2 plug-in in Browse Repositories. Download it. Below is a screenshot of my successful installation.

  • Open settings-otherSetting-junit Generator. The Output Path that the arrow points to is:{PACKAGE}/${FILENAME}This sets the directory in which to place the test classes when we create them.

  • To avoid garbled and guided packet errors in the test class, the circles should be the same as I set them in Junit3 and Junit4.

  • Next, in a random class, press Alt+ Insert to bring up the following window, which is Juint4. You’ll notice that the test class appears under the test/ Java directory. Hee hee.


#### Specific code examples

@Data
@NoArgsConstructor
@AllArgsConstructor
public class User {

    private String name;
    private String pwd;
    private String createTime;
    private String updateTime;


}
Copy the code
/**
 * Created by cmazxiaoma on 2017/6/20.
 * everyday is mayday.
 */

/**
 * set*/ Public class UserTest{private User user1,user2; @Before public voidsetUp() throws Exception {
        user1=new User("I am cmazxiaoma"."xiaoma"."Today"."Today");
        user2=new User();
        user2.setName("I am xiaoma");
        user2.setPwd("xiaoma");
    }

    @After
    public void tearDown() throws Exception {

    }

    @Test
    public void test(){ System.out.println(user1.toString()); System.out.println(user2.toString()); }}Copy the code
  • By pressing Ctrl+Shift+F10, we run the UserTest test class. The following output is displayed. The User class passed, indicating that there is no problem with the User class.

#### Conclusion Although the knowledge is very simple. Without induction, time will eventually be wasted. Instead of doing that, do something interesting, like generalize, and learn from the past. Believe that salted fish will have their day