Skip to content

Instantly share code, notes, and snippets.

View oliveiralex's full-sized avatar

Alexandre Oliveira oliveiralex

View GitHub Profile
@oliveiralex
oliveiralex / ExcecoesPersonalizadas.cs
Last active February 21, 2024 21:01
Examplo exceções personalizadas
using System;
namespace ExcecoesPersonalizadas
{
// Definindo uma exceção personalizada para divisão por zero
public class DivisaoPorZeroException : Exception
{
public DivisaoPorZeroException() : base("Divisão por zero não permitida.")
{
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.httpBasic;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.json.JacksonJsonParser;
import org.springframework.stereotype.Component;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
@oliveiralex
oliveiralex / JaCoCo Dscommerce
Last active January 9, 2024 17:25
JaCoCo Dscommerce
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.7</version>
<configuration>
<excludes>
<exclude>com/devsuperior/dscommerce/DscommerceApplication.class</exclude>
<exclude>com/devsuperior/dscommerce/config/**</exclude>
<exclude>com/devsuperior/dscommerce/entities/**</exclude>
<exclude>com/devsuperior/dscommerce/dto/**</exclude>
INSERT INTO tb_user (email, password) VALUES ('maria@gmail.com', '$2a$10$eACCYoNOHEqXve8aIWT8Nu3PkMXWBaOxJ9aORUYzfMQCbVBIhZ8tG');
INSERT INTO tb_user (email, password) VALUES ('alex@gmail.com', '$2a$10$eACCYoNOHEqXve8aIWT8Nu3PkMXWBaOxJ9aORUYzfMQCbVBIhZ8tG');
INSERT INTO tb_user (email, password) VALUES ('bob@gmail.com', '');
INSERT INTO tb_role (authority) VALUES ('ROLE_ADMIN');
INSERT INTO tb_user_role (user_id, role_id) VALUES (1, 1);
INSERT INTO tb_user_role (user_id, role_id) VALUES (2, 1);
INSERT INTO tb_movie(score, count, title, image) VALUES (4.5, 2, 'The Witcher', 'https://www.themoviedb.org/t/p/w533_and_h300_bestv2/jBJWaqoSCiARWtfV0GlqHrcdidd.jpg');
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath /> <!-- lookup parent from repository -->
@oliveiralex
oliveiralex / out.txt
Created June 18, 2022 15:12
Terminal commands example
Notepad++ v7.8.8 Enhancements & bug-fixes:
1. Fix accented characters in ANSI files not found in "find in files" and "replace in files" commands issues.
2. Add an option to improve rendering special Unicode characters by using Scintilla's DirectWrite technology.
3. Fix URL invisible issue in dark themes.
4. Fix the focus not on the opening new file issue.
5. Fix Workspace (Project panel), Folder As Workspace and function list keep focus issue after double clicking an item.
6. Add Ctrl+Backspace ability to delete word for comboboxes in Find/Replace dialog.
7. Add ability to find-all in selectesd text.
8. Fix wrong treatment of backslashes as escape sequences in autocompletion.
@oliveiralex
oliveiralex / docker-compose.yml
Created May 7, 2022 20:00
Docker compose to define spring boot app and postgres database
version: '2'
services:
app:
build: ./
container_name: app
ports:
- "8080:8080"
depends_on:
- db
@oliveiralex
oliveiralex / Dockerfile
Created May 7, 2022 19:57
Dockerfile to build an image JDK 17 to dsmovie backend
FROM openjdk:17
ARG JAR_FILE=target/dsmovie-0.0.1-SNAPSHOT.jar
COPY ${JAR_FILE} application.jar
ENTRYPOINT ["java", "-jar", "application.jar"]
EXPOSE 8080