怎么使Java 中测试按一定顺序执行
怎样使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<String, String> 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