Skip to main content

Posts

Showing posts from 2021

Array Extensions Library- Unit Test

Array Extensions Library- Unit Test This post is second in series of creating Array Extension Library  In this post we will learn how we can add unit test cases to our library. We will use Jasmine framework to Unit test our library. For that, use below command. >> npm install jasmine As we have developed our library in typescript, it will convenient to add typing for Jasmine as well. To install typing for Jasmine. Use below command. >> npm uninstall @types/jasmine   After running these commands, our package.config will look like Now, we will add new file named extension.spec.ts under test  directory. In this file we will import extension library first. We will now define one class named Heros,   Which we use to create Array  and test all our extension methods against it. Now we will describe our test suite using describe function provided by Jasmine. And initialize arrays with our primitive and custom type(Heros)   in beforeEach function provided by jasmine. Now, we will

Extension method library for Javascript Array using Typescript

  Array Extension methods - Typescript     This is step by step guide to create custom library for extension method on Javascript Array using Typescript. Tools and framework we are going to use are Visual studio code , which you can download from here . Framework : NodeJs Open Command prompt and type following commands mkdir demo-extension-lib cd demo-extension-lib We are in your target directory, type following command npm init npm will guide you through the series of questions. Which you can change according to your requirement or go with the default ones. Once npm  is done with initialization,  Open demo-extension-lib in any editor of your choice. We will use Visual Studio Code for our demo. You will se single file package.json as we do not have any other library install. We will start by adding two directory src - for source code and test - to add test cases. Add type script file with name extension.ts. In that file, declare Array interface to global namespace One thing to not

Visual Studio code - Setting up Tomcat server

  This is the second post in series of Setting up Visual Studio code for Java Spring Boot development. First post of this series can be found here . In this article we will see how we can configure VS Code to run Apache Tomcat server via extension. So lets begin. Open your VS Code and click on Extensions menu item. Now search for "Tomcat For Java". Select extension From Wei Shen and click install. Once this extension is installed. we can see new tab panel enabled in Explorer window. When we expand it, its empty. Now we need to configure Tomcat. For that, we need to download Apache Tomcat from official site. To download Tomcat click here to redirect to official site. There are multiple version available to download. For this demo we will download Tomcat Version 9.  Once Tomcat is downloaded to our machine. We now navigate back to VS code. We can now configure Tomcat by click on "+" sign on "Tomcat Servers" panel. When we click on Add Tomcat Server "

Setting up Visual Studio code for Java Spring boot development

  Download Visual Studio Code to your machine by clicking here . You will be redirected to official download site for VS Code. You can download VS depending on your OS. When we open VS Code and click on explorer (Ctrl+Shft+E). There two options available by default. Open Folder Clone Repository Visual Studio code is an Editor not a full fledged IDE. But we can configure VS Code by installing relevant extensions available at  https://marketplace.visualstudio.com/vscode . To install extension directly from Visual Studio, click on Extension icon on Menu item at left panel. Alternatively we can use Ctrl+Shft+X keyboard short cut. First extension we going to search is "Extension Pack From Java" from Microsoft. This extension pack is collection of extensions which is needed to enabled Java development in General. Language Support for Java - Rad Hat Debugger for Java - Microsoft Maven for Java - Microsoft Test Runner for Java - Microsoft Project Manager for Java - Microsoft. Next ex