高效组合测试框架 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

运营之光 2.0

运营之光 2.0

黄有璨 / 电子工业出版社 / 2017-4 / 99

在互联网行业内,“运营”这个职能发展到一定阶段后,往往更需要有成熟的知识体系和工作方法来给予行业从业者以指引。 《运营之光:我的互联网运营方法论与自白 2.0》尤其难得之处在于:它既对“什么是运营”这样的概念认知类问题进行了解读,又带有大量实际的工作技巧、工作思维和工作方法,还包含了很多对于运营的思考、宏观分析和建议,可谓内容完整而全面,同时书中加入了作者亲历的大量真实案例,让全书读起来深入......一起来看看 《运营之光 2.0》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

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

Markdown 在线编辑器