Skip to content

Instantly share code, notes, and snippets.

View frekele's full-sized avatar
:octocat:
☕️ 🍩 📚

Leandro Kersting de Freitas frekele

:octocat:
☕️ 🍩 📚
  • Brazil
View GitHub Profile
public class MockitoTest {
@Mock
MyDatabase databaseMock;
@Rule public MockitoRule mockitoRule = MockitoJUnit.rule();
@Test
public void testQuery() {
ClassToTest t = new ClassToTest(databaseMock);
class CalculatorJUnit5Tests {
private final Calculator calculator = new Calculator();
@Test
void addition() {
assertEquals(2, calculator.add(1, 1));
}
}
public interface CustomerRepository extends MongoRepository<Customer, String> {
public Customer findByFirstName(String firstName);
public List<Customer> findByLastName(String lastName);
}
@SpringBootApplication(scanBasePackages = "org.frekele.nikoday")
public class NikodayApplication {
public static void main(String[] args) {
SpringApplication.run(NikodayApplication.class, args);
}
}
public class Team {
@NotNull(groups = {OnCreate.class, OnUpdate.class})
@NotEmpty(groups = {OnCreate.class, OnUpdate.class})
private String name;
@NotNull(groups = {OnCreate.class, OnUpdate.class})
private ConfigTeam config;
@NotNull
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class Emotion {
private String name;
private String icon;
@frekele
frekele / aws-update-my-dynamic-ip.sh
Last active September 4, 2020 14:12
Script Update Dynamic Ips into AWS EC2 Security Groups. To run need to install aws cli, JQ and dnsutils.
#!/bin/bash
if [ $# -eq 0 ]
then
echo -e 'Please provide the name of a security group\n\te.g. . aws-update-my-dynamic-ip.sh SECURITYGROUPNAME'
exit 1
fi
GROUP_NAME=$1
@frekele
frekele / Jenkinsfile
Created August 4, 2016 06:18
Jenkinsfile pipelineTriggers - TimerTrigger periodic run the aws-update-my-dynamic-ip.sh script.
#!groovy
MAIL_FROM = 'noreply-jenkins@myhost.io'
MAIL_TO = 'jenkins@myhost.io'
GITHUB_PROTOCOL = 'https'
GITHUB_USER_NAME = 'my-github-user'
GITHUB_USER_EMAIL = 'jenkins@myhost.io'
GITHUB_REPO = 'github.com/my-user/my-repository'
GITHUB_PROJECT_URL = "${GITHUB_PROTOCOL}://${GITHUB_REPO}"
@frekele
frekele / ThreadDemo02.java
Created October 20, 2019 05:45
ThreadDemo02.java
import java.util.logging.Level;
import java.util.logging.Logger;
public class Main {
public static void main(String[] args) {
for (int i = 1; i < 11; i++)
new MyThread("Multiples of " + i, i, i * 10).start();
}
}
@frekele
frekele / ThreadDemo01.java
Last active October 20, 2019 05:45
ThreadDemo01
import java.util.logging.Level;
import java.util.logging.Logger;
public class Main {
public static void main(String[] args) {
new MyThread().start();
MyRunnable myRunnable = new MyRunnable();
new Thread(myRunnable).start();