Posts mit dem Label howto werden angezeigt. Alle Posts anzeigen
Posts mit dem Label howto werden angezeigt. Alle Posts anzeigen

Montag, 7. Oktober 2019

How to create Nav with Angular + Angular Material

To setup a basic navigation in Angular Material, type the following command in your terminal (e.g. I am using WebStorm IDE):

$ ng generate @angular/material:material.nav -name=main-nav

This will create a component named main-nav with all basic elements, fully responsive and free to modify.

Mittwoch, 17. April 2019

Mock static methods with Mockito in Java (mock, static, method, java)


import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.BDDMockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;


@RunWith(PowerMockRunner.class)
@PrepareForTest(MyStatic.class)
...


@Test
public void someTest() {
    
    //given    
    PowerMockito.mockStatic(MyStatic.class);
    BDDMockito.given(MyStatic.someStaticMethod()).willReturn(...);

    //when
    ...

    //then     
    PowerMockito.verifyStatic();
    MyStatic.someStaticMethod();

    assertThat(//your further asserts....

NEW BLOG! http://cleancode.consulting/

Dear Reader, This Blog is closed and remains as an archive. Please find our new Blog at  http://cleancode.consulting/