Home » Java

Java

Creating effective UI system tests with Selenium

java-interview-questions-answers

In this video, I’m showing how to create effective UI system tests with Selenium. In my previous video course on effective testing, I’ve introduced the coffee shop application, which we now enhanced with some basic HTML views. Selenium is a powerful web driver technology, to programmatically simulate user behavior in a browser, and helps us to create UI system tests. ...

Read More »

Handling Cross-Site Scripting (XSS) in Java

Cross-site scripting (XSS) is a type of security vulnerability in web applications where an attacker injects malicious scripts through some kind of user input (like input boxes, URL parameters, HTML headers, etc)It is important to prevent XSS attacks to safeguard the confidentiality, integrity, and availability of the information of the web application. The two main cross-site scripting flaws are reflected ...

Read More »

Automate Technical Documentation using Jamal

Introduction Writing good technical documentation is an art. An art is the expression or application of human creative skill and imagination, … to be appreciated primarily for their beauty or emotional power. But every art, like sculpting, has a craft part. You need chisels, hammers to form the sculpture out of the blob of marble. You need to learn the ...

Read More »

Retry In The Future

Writing asynchronous code in Javascript is relatively easy. // async function let attempt = 1; while (true) { try { const result = await operationThatMayFail(); // it didn't fail return result; } catch (error) { if (attempt >= maxAttempts || error !== 'Retryable') { // either unhandleable, or no further attempts throw error; } } attempt++; await sleep(pauseTime); } This ...

Read More »

REST API Design: Dealing with concurrent updates

java-interview-questions-answers

Concurrency control can be an important part of a REST API, especially if you expect concurrent update requests for the same resource. In this post we will look at different options to avoid lost updates over HTTP. Let’s start with an example request flow, to understand the problem: We start with Alice and Bob requesting the resource /articles/123 from the ...

Read More »

Upload files in Spring Boot application using Commons FileUpload

spring-interview-questions-answers

In our previous post, we saw how to upload a file using the Spring framework’s default implementation for MultipartFile interface. In this post, we will see how we can use the Commons FileUpload library and the wrapper implementation CommonsMultipartFile provided by the Spring framework. Update the pom.xml We will update the maven dependencies to include commons-io and commons-fileupload. We will ...

Read More »

Uploading files in Spring Boot application

spring-interview-questions-answers

Uploading files is one of the most common operations in a web application. In this article we will look at how to upload file from an HTML page and copy it to the file system on the server. Creating a HTML form with file upload option The below HTML code and its corresponding Javascript code creates the HTML form and ...

Read More »

Unit testing private methods

Introduction In this article, I will contemplate the testing of private methods in unit tests. After that, I will propose a way or pattern to do it, if you must. Finally, I will show how you can generate this pattern automatically. And yes, I will also write a takeaway section to know what you have read. Test or not to ...

Read More »