How To Install libpowermock-java on Debian 9

In this tutorial we learn how to install libpowermock-java on Debian 9. libpowermock-java is PowerMock testing framework for Java

Introduction

In this tutorial we learn how to install libpowermock-java on Debian 9.

What is libpowermock-java

libpowermock-java is:

PowerMock allows you to unit test code normally regarded as untestable. For instance it is possible to mock static methods, remove static initializers, allow mocking without dependency injection and more. PowerMock works by bytecode manipulation. PowerMock also contain some utilities that gives you easier access to an objects internal state. PowerMock can be used to test otherwise untestable code and also to achieve a cleaner separation between test and production code.

There are three methods to install libpowermock-java on Debian 9. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install libpowermock-java Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install libpowermock-java using apt-get by running the following command:

sudo apt-get -y install libpowermock-java

Install libpowermock-java Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install libpowermock-java using apt by running the following command:

sudo apt -y install libpowermock-java

Install libpowermock-java Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install libpowermock-java using aptitude by running the following command:

sudo aptitude -y install libpowermock-java

How To Uninstall libpowermock-java on Debian 9

To uninstall only the libpowermock-java package we can use the following command:

sudo apt-get remove libpowermock-java

Uninstall libpowermock-java And Its Dependencies

To uninstall libpowermock-java and its dependencies that are no longer needed by Debian 9, we can use the command below:

sudo apt-get -y autoremove libpowermock-java

Remove libpowermock-java Configurations and Data

To remove libpowermock-java configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge libpowermock-java

Remove libpowermock-java configuration, data, and all of its dependencies

We can use the following command to remove libpowermock-java configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge libpowermock-java

Dependencies

libpowermock-java have the following dependencies:

References

Summary

In this tutorial we learn how to install libpowermock-java package on Debian 9 using different package management tools: apt, apt-get and aptitude.