mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 08:58:49 +00:00
Java 11 migration: ambassador async-method-invocation balking bridge builder (#1076)
* Moves ambassador pattern to java 11 * Moves async-method-invocation pattern to java 11 * Moves balking pattern to java 11 * Moves bridge pattern to java 11 * Moves builder pattern to java 11
This commit is contained in:
committed by
Ilkka Seppälä
parent
f0f0143d48
commit
c4418311c6
@@ -26,15 +26,11 @@ package com.iluwatar.builder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* Application test
|
||||
*
|
||||
*/
|
||||
public class AppTest {
|
||||
|
||||
class AppTest {
|
||||
@Test
|
||||
public void test() {
|
||||
String[] args = {};
|
||||
App.main(args);
|
||||
void test() {
|
||||
App.main(new String[]{});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,24 +23,24 @@
|
||||
|
||||
package com.iluwatar.builder;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Date: 12/6/15 - 11:01 PM
|
||||
*
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public class HeroTest {
|
||||
class HeroTest {
|
||||
|
||||
/**
|
||||
* Test if we get the expected exception when trying to create a hero without a profession
|
||||
*/
|
||||
@Test
|
||||
public void testMissingProfession() throws Exception {
|
||||
void testMissingProfession() {
|
||||
assertThrows(IllegalArgumentException.class, () -> new Hero.Builder(null, "Sir without a job"));
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class HeroTest {
|
||||
* Test if we get the expected exception when trying to create a hero without a name
|
||||
*/
|
||||
@Test
|
||||
public void testMissingName() throws Exception {
|
||||
void testMissingName() {
|
||||
assertThrows(IllegalArgumentException.class, () -> new Hero.Builder(Profession.THIEF, null));
|
||||
}
|
||||
|
||||
@@ -56,10 +56,10 @@ public class HeroTest {
|
||||
* Test if the hero build by the builder has the correct attributes, as requested
|
||||
*/
|
||||
@Test
|
||||
public void testBuildHero() throws Exception {
|
||||
void testBuildHero() {
|
||||
final String heroName = "Sir Lancelot";
|
||||
|
||||
final Hero hero = new Hero.Builder(Profession.WARRIOR, heroName)
|
||||
final var hero = new Hero.Builder(Profession.WARRIOR, heroName)
|
||||
.withArmor(Armor.CHAIN_MAIL)
|
||||
.withWeapon(Weapon.SWORD)
|
||||
.withHairType(HairType.LONG_CURLY)
|
||||
|
||||
Reference in New Issue
Block a user