use of org.junit.jupiter.api.Test in project java-design-patterns by iluwatar.
the class CommanderTest method commanderReady.
@Test
public void commanderReady() throws Exception {
final Commander commander = new Commander(new CommanderUnit("CommanderUnitTest"));
commander.commanderReady();
}
use of org.junit.jupiter.api.Test in project java-design-patterns by iluwatar.
the class SoldierTest method soldierReady.
@Test
public void soldierReady() throws Exception {
final Soldier soldier = new Soldier(new SoldierUnit("SoldierUnitTest"));
soldier.soldierReady();
}
use of org.junit.jupiter.api.Test in project java-design-patterns by iluwatar.
the class FactoryKitTest method testAxeWeapon.
/**
* Testing {@link WeaponFactory} to produce a AXE asserting that the Weapon is an instance of {@link Axe}
*/
@Test
public void testAxeWeapon() {
Weapon weapon = factory.create(WeaponType.AXE);
verifyWeapon(weapon, Axe.class);
}
use of org.junit.jupiter.api.Test in project java-design-patterns by iluwatar.
the class ContentStoreTest method testOnAction.
@Test
public void testOnAction() throws Exception {
final ContentStore contentStore = new ContentStore();
final View view = mock(View.class);
contentStore.registerView(view);
verifyZeroInteractions(view);
// Content should not react on menu action ...
contentStore.onAction(new MenuAction(MenuItem.PRODUCTS));
verifyZeroInteractions(view);
// ... but it should react on a content action
contentStore.onAction(new ContentAction(Content.COMPANY));
verify(view, times(1)).storeChanged(eq(contentStore));
verifyNoMoreInteractions(view);
assertEquals(Content.COMPANY, contentStore.getContent());
}
use of org.junit.jupiter.api.Test in project java-design-patterns by iluwatar.
the class ContentViewTest method testStoreChanged.
@Test
public void testStoreChanged() throws Exception {
final ContentStore store = mock(ContentStore.class);
when(store.getContent()).thenReturn(Content.PRODUCTS);
final ContentView view = new ContentView();
view.storeChanged(store);
verify(store, times(1)).getContent();
verifyNoMoreInteractions(store);
}
Aggregations