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
public class MockitoTest { | |
@Mock | |
MyDatabase databaseMock; | |
@Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); | |
@Test | |
public void testQuery() { | |
ClassToTest t = new ClassToTest(databaseMock); |
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
class CalculatorJUnit5Tests { | |
private final Calculator calculator = new Calculator(); | |
@Test | |
void addition() { | |
assertEquals(2, calculator.add(1, 1)); | |
} | |
} |
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
@SpringBootApplication(scanBasePackages = "org.frekele.nikoday") | |
public class NikodayApplication { | |
public static void main(String[] args) { | |
SpringApplication.run(NikodayApplication.class, args); | |
} | |
} |
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
public interface CustomerRepository extends MongoRepository<Customer, String> { | |
public Customer findByFirstName(String firstName); | |
public List<Customer> findByLastName(String lastName); | |
} |
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
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 |
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
@Data | |
@AllArgsConstructor | |
@NoArgsConstructor | |
@EqualsAndHashCode(callSuper = true) | |
public class Emotion { | |
private String name; | |
private String icon; |
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.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(); | |
} | |
} |
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.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(); |
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.math.BigDecimal; | |
import java.time.Duration; | |
import java.time.Instant; | |
import java.util.Scanner; | |
public class IterativeFibonacci { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
System.out.println("Enter a number:"); |
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.math.BigDecimal; | |
import java.time.Duration; | |
import java.time.Instant; | |
import java.util.Scanner; | |
public class IterativeFactor { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
System.out.println("Enter a factorial:"); |
NewerOlder