This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.time.LocalDateTime; | |
| import java.time.ZoneId; | |
| import java.time.ZonedDateTime; | |
| /** | |
| * This method converts the input date given in the below format from UTC time zone to AUS time zone | |
| * | |
| * ipDt = "2019-09-08T21:15:10"; | |
| */ | |
| public void changeTheTimeZone(String ipDt) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <plugin> | |
| <groupId>org.jvnet.jaxb2.maven2</groupId> | |
| <artifactId>maven-jaxb2-plugin</artifactId> | |
| <version>0.12.3</version> | |
| <executions> | |
| <execution> | |
| <goals> | |
| <goal>generate</goal> | |
| </goals> | |
| <phase>clean</phase> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| button, input { | |
| font-family: inherit; | |
| font-size: 100%; | |
| } | |
| input { | |
| -webkit-box-sizing: border-box; | |
| box-sizing: border-box; | |
| } | |
| label { | |
| display: block; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>HTML 101</title> | |
| <meta charset="utf-8"/> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"/> | |
| <!-- links the style sheet applicable for this html --> | |
| <link href="css-101.css" rel="stylesheet"/> | |
| </head> | |
| <body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.hamcrest.CoreMatchers; | |
| import org.junit.Rule; | |
| import org.junit.Test; | |
| import org.junit.rules.ExpectedException; | |
| public class ValidatorTest { | |
| @Rule | |
| public ExpectedException thrown = ExpectedException.none(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @ExceptionHandler (value = {NumberFormatException.class}) | |
| public final ResponseEntity<ServiceErrorResponse> invalidNumberHandling(Exception e) { | |
| ServiceErrorResponse serviceResponse = new ServiceErrorResponse( | |
| HttpStatus.BAD_REQUEST.value(), | |
| HttpStatus.BAD_REQUEST.value() * 1000 | |
| + 101, e.getMessage()); | |
| return new ResponseEntity<ServiceErrorResponse>(serviceResponse, new HttpHeaders(), HttpStatus.BAD_REQUEST); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.springframework.http.HttpHeaders; | |
| import org.springframework.http.HttpStatus; | |
| import org.springframework.http.ResponseEntity; | |
| import org.springframework.web.bind.annotation.ControllerAdvice; | |
| import org.springframework.web.bind.annotation.ExceptionHandler; | |
| import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; | |
| // annotation that ties up controller and this handler class | |
| @ControllerAdvice | |
| public class SampleDefaultExceptionHandler extends ResponseEntityExceptionHandler{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.awt.Rectangle; | |
| import org.apache.pdfbox.pdmodel.PDDocument; | |
| import org.apache.pdfbox.pdmodel.PDPage; | |
| import org.apache.pdfbox.text.PDFTextStripperByArea; | |
| // import other apis as required | |
| @Test | |
| public void getDocByIdTest() throws Exception { | |
| // mock input data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.springframework.boot.test.web.client.TestRestTemplate; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.boot.test.context.SpringBootTest; | |
| import org.springframework.boot.test.mock.mockito.MockBean; | |
| import org.springframework.http.HttpStatus; | |
| import org.springframework.http.ResponseEntity; | |
| import org.springframework.test.context.junit4.SpringRunner; | |
| import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; | |
| import org.junit.runner.RunWith; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.json.JSONObject; | |
| import org.skyscreamer.jsonassert.JSONAssert; | |
| public class ValidateJsonResponse { | |
| // used for unit testing purposes | |
| public static void main(String[] args) { | |
| String expectedResponse = "{\"fault\":{\"detail\":{\"errorcode\":\"User unauthorized\"},\"faultstring\":\"Invalid access token\"}}"; |
NewerOlder