高效组合测试框架 Jukito

码农软件 · 软件分类 · 测试工具 · 2019-11-21 14:12:33

软件介绍

 JUnit、 Guice、 Mockito 高效组合测试框架。

如果你使用 Google Guice,或者如果你的GWT应用程序使用 Gin,那么,Jukito 是解决你的单元测试头痛的灵丹妙药。现在,你可进行如下测试:

@RunWith(JukitoRunner.class)
public class EmailSystemTest {

  @Inject EmailSystemImpl emailSystem;
  Email dummyEmail;
  
  @Before
  public void setupMocks(
      IncomingEmails incomingEmails, 
      EmailFactory factory) {
    dummyEmail = factory.createDummy();
    when(incomingEmails.count()).thenReturn(1);
    when(incomingEmails.get(0)).thenReturn(dummyEmail);
  }
  
  @Test
  public void shouldFetchEmailWhenStarting(
      EmailView emailView) {  
     // WHEN
    emailSystem.start();    
    
    // THEN
    verify(emailView).addEmail(dummyEmail);
  }
}

或者:

@RunWith(JukitoRunner.class)
public class CalculatorTest {

  public static class Module extends JukitoModule {
    protected void configureTest() {
      bindMany(Calculator.class,
          ScientificCalculator.class,
          BusinessCalculator.class);

      bindManyInstances(AdditionExample.class, 
          new AdditionExample(1, 1, 2),
          new AdditionExample(10, 10, 20),
          new AdditionExample(18, 24, 42));
    }
  }

  @Test
  public void testAdd(@All Calculator calculator, @All AdditionExample example) {
    // WHEN
    int result = calculator.add(example.a, example.b);

    // THEN
    assertEquals(example.expected, result);
  }
}

本文地址:https://codercto.com/soft/d/19477.html

Open Data Structures

Open Data Structures

Pat Morin / AU Press / 2013-6 / USD 29.66

Offered as an introduction to the field of data structures and algorithms, Open Data Structures covers the implementation and analysis of data structures for sequences (lists), queues, priority queues......一起来看看 《Open Data Structures》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

html转js在线工具
html转js在线工具

html转js在线工具