Java learning notes - unit testing (JUnit framework)

Before unit testing, you need to install the JUnit framework. Here you can see my previous blog Record the problems encountered when installing the JUnit framework and the solutions After installation, you can write the code of unit test What is unit testing? Unit testing is to write test code for the smallest functional unit. The smallest ...

Posted by warriors2003 on Sun, 10 Oct 2021 00:13:28 -0700

[JUnit] JUnit 5 Foundation 3 - dependency injection, assume, enable / disable testing and nested testing

[JUnit] JUnit 5 Foundation 3 - dependency injection, assume, enable / disable testing and nested testing Dependency Injection Before Junit 5, Junit did not support passing parameters in test constructors or methods very well, but Junit 5 allows metadata to be passed into constructors and methods, so dependency injection can also be used in te ...

Posted by LarsLai on Thu, 07 Oct 2021 02:06:13 -0700

Practice of object-oriented design based on Java

Object oriented design practice (based on java) caiyi 2021/10/1 source: https://www.icourse163.org/spoc/course/ECNU-1464731161 Chapter I Maven Maven concept Automatically download and manage jar packages, configure build path, and have local build tools to manage, compile, test, run, package and publish java projects Maven compilation ...

Posted by bob_dole on Fri, 01 Oct 2021 14:53:38 -0700

java design pattern Decorator Pattern

Decorator mode Reference documents: http://c.biancheng.net/view/1366.html   In real life, it is often necessary to add new functions or beautify the appearance of existing products, such as house decoration, photo frame and so on. In the process of software development, sometimes you want to use s ...

Posted by satyac46 on Sun, 28 Jun 2020 20:19:16 -0700

Junit unit test and reflection

1.Junit unit test Test classification: 1. Black box test: do not need to write code, do not see the process of program execution, input some parameters, and see the expected results. 2. White box test: you need to write code, you can see the process of program execution, enter some parameters, and see ...

Posted by rolwong on Sat, 27 Jun 2020 00:05:30 -0700

PowerMockito.mockStatic(class) simulate static method call

Article catalog PowerMockito.mockStatic(class) simulate static method call Why write unit tests Introduce dependency Simulation tool class calls static methods Notes PowerMockito.mockStatic(class) simulate static method call Why write unit tests give us the confidence to refactor. A bunch o ...

Posted by _theworks on Mon, 22 Jun 2020 22:22:57 -0700

Java client in Redis (Jedis / Lettuce)

This article learns to use a Java client (Jedis / Lettuce) to operate Redis. 1 Open remote connection Redis does not support remote connections by default and needs to be turned on and modified manuallyRedis.confThere are three major changes: vi /usr/local/redis-5.0.8/redis.conf # bind 127.0.0.1 protected-mode no requirepass 123456 Then resta ...

Posted by poppy28 on Sun, 14 Jun 2020 18:13:51 -0700

Full text retrieval technology_ Lucene index file

The creation of index file, an important part of the full text, can be realized through Lucene. Create index basic process Select a folder as the directory for index output. Create index output stream object Read the data source, encapsulate the document object, and define the attributes of the docum ...

Posted by borris_uk on Sat, 13 Jun 2020 20:56:25 -0700

[Java] uses reflection to execute the methods specified by Spring container Bean, and supports automatic calling of multiple parameters

catalog Usage scenarios objective Implementation mode Premise: thinking Core class test method Source sharing Usage scenarios Input the scheduled task into the database (the advantage of this is the visualization of the scheduled task, and the execution time of each task can be modified dynamically), and execute the corresponding method ...

Posted by Chris Val Kef on Sat, 13 Jun 2020 03:06:01 -0700

Use of surefire plug-in

Article catalog Write in front Combined with TestNG configuration Combined with Junit configuration Matching mvn command use Write in front The surefire plug-in is used in the test phase of maven's life cycle for testing. It provides some mvn operations that are convenient for us to perform th ...

Posted by slj90 on Fri, 12 Jun 2020 02:24:24 -0700