怎样使Java 中测试按一定顺序执行

@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class EventAlarmViewTest {

    private String inverterId = "inverter1";

    @Test
    public void whenHasAlarmErrorThenShowAlarmErrorDetails() {
        // given
        EventAlarmView view = new EventAlarmView(inverterId, 4, 0, 0, 0, 0, new TripleVoltage(51, 51, 51));

        // when
        Map result = view.showAlarmView();

        // then
        assertThat(result, hasEntry("div_pv_tips_1", HTML_WARN_IMG));
        assertThat(result, hasEntry("div_alarm_panel", HTML_ALARM_ON_IMG + HTML_ALARM_ON_AUDIO));
    }
}

 

使用注释 @FixMethodOrder 

你可能感兴趣的:(Java基础)