@Test public void username_usernamefield_password_passwordfield_click_buttonfield() { List<LoginScriptStep> steps = new ArrayList<LoginScriptStep>(); LoginScriptStep step1 = mock(LoginScriptStep.class); LoginScriptStep step2 = mock(LoginScriptStep.class); LoginScriptStep step3 = mock(LoginScriptStep.class); when(step1.getSelector()).thenReturn("#usernamefield"); when(step1.getValue()).thenReturn("username1"); when(step1.isUserName()).thenReturn(true); when(step2.getSelector()).thenReturn("#passwordfield"); when(step2.getValue()).thenReturn("password1"); when(step2.isPassword()).thenReturn(true); when(step3.getType()).thenReturn("click"); when(step3.getSelector()).thenReturn("#buttonfield"); when(step3.isClick()).thenReturn(true); steps.add(step1); steps.add(step2); steps.add(step3); String result = genoToTest.generate(steps); String expected = "ns.auth.setValueByQuery('#usernamefield',username);\n"; expected+="ns.auth.setValueByQuery('#passwordfield',password);\n"; expected+="ns.auth.clickByQuery('#buttonfield',2000);\n"; assertEquals(expected,result); }
public String generate(List<LoginScriptStep> steps) { StringBuilder sb = new StringBuilder(); generate(steps, sb); return sb.toString(); }
NetsparkerLoginScriptGenerator implements LoginScriptGenerator { public String generate(List<LoginScriptStep> steps) { StringBuilder sb = new StringBuilder(); generate(steps, sb); return sb.toString(); } }
NetsparkerLoginScriptGenerator implements LoginScriptGenerator { public String generate(List<LoginScriptStep> steps) { StringBuilder sb = new StringBuilder(); generate(steps, sb); return sb.toString(); }  }
NetsparkerLoginScriptGenerator implements LoginScriptGenerator { public String generate(List<LoginScriptStep> steps) { StringBuilder sb = new StringBuilder(); generate(steps, sb); return sb.toString(); }  String generate(List<LoginScriptStep> steps); }
NetsparkerLoginScriptGenerator implements LoginScriptGenerator { public String generate(List<LoginScriptStep> steps) { StringBuilder sb = new StringBuilder(); generate(steps, sb); return sb.toString(); }  String generate(List<LoginScriptStep> steps);  }