当前位置: 首页>>代码示例>>Java>>正文


Java Executable类代码示例

本文整理汇总了Java中org.junit.jupiter.api.function.Executable的典型用法代码示例。如果您正苦于以下问题:Java Executable类的具体用法?Java Executable怎么用?Java Executable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Executable类属于org.junit.jupiter.api.function包,在下文中一共展示了Executable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupTest

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
private Executable setupTest(YamlTestGroup yamlTestGroup, YamlTest yamlTest, String testcaseName) {

		RequestSpecification rs = given().spec(rspec);

		Executable executable = () -> {
			logger.info("\n\n\n-->start " + testcaseName);
			// Initialize current state to be access globally
			CurrentState.setState(yamlInitGroup, yamlTestGroup, yamlDataGroup, yamlTest);

			try {
				RestRequest.build(rs, yamlTest).request().doAssert();
			} catch (Throwable e) {
				e.printStackTrace();
				throw e;
			}

			logger.info("-->end " + testcaseName +"\n\n\n");
		};

		return executable;
	}
 
开发者ID:ERS-HCL,项目名称:rest-yaml-test,代码行数:22,代码来源:MainTest.java

示例2: getExecutable

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
private Executable getExecutable(File file, boolean isMatch) {
    return () -> {
        String jsonString = fileUtils.read(file);

        jsonValidator.validate(String.format("Invalid JSON in file '%s'.", file.getName()), jsonString);

        Response response = client.target(configuration.getLocalMatchingServiceMatchUrl())
            .request(APPLICATION_JSON)
            .post(Entity.json(jsonString));

        assertThat(response.getHeaderString("Content-Type"), is(APPLICATION_JSON));
        assertThat(response.getStatus(), is(OK.getStatusCode()));

        Map<String, String> result = readEntityAsMap(response);

        assertThat(result.keySet(), is(new HashSet<String>() {{ add("result"); }}));
        assertThat(result.get("result"), is(isMatch ? "match" : "no-match"));
    };
}
 
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:20,代码来源:DynamicScenarios.java

示例3: Should_Change_Value

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
private Executable Should_Change_Value(final BigInteger value) {
    return () -> {
        // given
        final AllFiledTypes helpClass1 = new AllFiledTypes(value);
        final AllFiledTypes helpClass2 = new AllFiledTypes(value);

        // when
        valueChanger.changeFieldsValues(helpClass1,
                                        helpClass2,
                                        Lists.newArrayList(AllFiledTypes.class.getDeclaredFields()));
        final BigInteger result1 = getInternalState(helpClass1, "bigInteger");
        final BigInteger result2 = getInternalState(helpClass2, "bigInteger");

        // then
        assertThat(result1).isNotEqualTo(result2);
    };
}
 
开发者ID:sta-szek,项目名称:pojo-tester,代码行数:18,代码来源:BigIntegerValueChangerTest.java

示例4: test_resolveEntity_With_UUID_Throws_IllegalStateException_if_passed_Context_is_disposed

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
@Test
public void test_resolveEntity_With_UUID_Throws_IllegalStateException_if_passed_Context_is_disposed()
{
    new Expectations()
    {{
        testContext.isDisposed(); result = true;
    }};

    assertThrows(IllegalStateException.class, new Executable()
    {
        @Override
        public void execute()
        {
            testee.resolveEntity(testContext, TEST_UUID);
        }
    });
}
 
开发者ID:jayware,项目名称:entity-essentials,代码行数:18,代码来源:EntityManagerImplTest.java

示例5: Expectations

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
@Test
public void test_removeComponent_Throws_IllegalStateException_if_the_Context_to_which_the_ContextualComponentManager_belongs_to_has_been_disposed()
{
    new Expectations()
    {{
        testContext.isDisposed(); result = true;
    }};

    assertThrows(IllegalStateException.class, new Executable()
    {
        @Override
        public void execute()
        {
            testee.removeComponent(testRefA, TestComponentA.class);
        }
    });
}
 
开发者ID:jayware,项目名称:entity-essentials,代码行数:18,代码来源:ContextualComponentManagerImplTest.java

示例6: test_addComponent_Throws_IllegalArgumentException_if_the_passed_Class_is_null

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
@Test
public void test_addComponent_Throws_IllegalArgumentException_if_the_passed_Class_is_null()
{
    new Expectations()
    {{
        testRefA.belongsTo(testContext); result = true;
    }};

    assertThrows(IllegalArgumentException.class, new Executable()
    {
        @Override
        public void execute()
        {
            testee.addComponent(testRefA, (Class<Component>) null);
        }
    });
}
 
开发者ID:jayware,项目名称:entity-essentials,代码行数:18,代码来源:ContextualComponentManagerImplTest.java

示例7: test_getComponent_Throws_IllegalArgumentException_if_the_passed_Class_is_null

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
@Test
public void test_getComponent_Throws_IllegalArgumentException_if_the_passed_Class_is_null()
{
    new Expectations()
    {{
        testRefA.belongsTo(testContext); result = true;
    }};

    assertThrows(IllegalArgumentException.class, new Executable()
    {
        @Override
        public void execute()
        {
            testee.getComponent(testRefA, null);
        }
    });
}
 
开发者ID:jayware,项目名称:entity-essentials,代码行数:18,代码来源:ContextualComponentManagerImplTest.java

示例8: Should_Change_Wrapped_Value

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
private Executable Should_Change_Wrapped_Value(final Byte value) {
    return () -> {
        // given
        final AllFiledTypes_Wrapped helpClass1 = new AllFiledTypes_Wrapped(value);
        final AllFiledTypes_Wrapped helpClass2 = new AllFiledTypes_Wrapped(value);

        // when
        valueChanger.changeFieldsValues(helpClass1,
                                        helpClass2,
                                        Lists.newArrayList(AllFiledTypes_Wrapped.class.getDeclaredFields()));
        final Byte result1 = getInternalState(helpClass1, "byteType");
        final Byte result2 = getInternalState(helpClass2, "byteType");

        // then
        assertThat(result1).isNotEqualTo(result2);
    };
}
 
开发者ID:sta-szek,项目名称:pojo-tester,代码行数:18,代码来源:ByteValueChangerTest.java

示例9: Should_Change_Wrapped_Value

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
private Executable Should_Change_Wrapped_Value(final Long value) {
    return () -> {
        // given
        final AllFiledTypes_Wrapped helpClass1 = new AllFiledTypes_Wrapped(value);
        final AllFiledTypes_Wrapped helpClass2 = new AllFiledTypes_Wrapped(value);

        // when
        valueChanger.changeFieldsValues(helpClass1,
                                        helpClass2,
                                        Lists.newArrayList(AllFiledTypes_Wrapped.class.getDeclaredFields()));
        final Long result1 = getInternalState(helpClass1, "longType");
        final Long result2 = getInternalState(helpClass2, "longType");

        // then
        assertThat(result1).isNotEqualTo(result2);
    };
}
 
开发者ID:sta-szek,项目名称:pojo-tester,代码行数:18,代码来源:LongValueChangerTest.java

示例10: Should_Change_Primitive_Value

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
private Executable Should_Change_Primitive_Value(final Short value) {
    return () -> {
        // given
        final AllFiledTypes helpClass1 = new AllFiledTypes(value);
        final AllFiledTypes helpClass2 = new AllFiledTypes(value);

        // when
        valueChanger.changeFieldsValues(helpClass1,
                                        helpClass2,
                                        Lists.newArrayList(AllFiledTypes.class.getDeclaredFields()));
        final Short result1 = getInternalState(helpClass1, "shortType");
        final Short result2 = getInternalState(helpClass2, "shortType");

        // then
        assertThat(result1).isNotEqualTo(result2);
    };
}
 
开发者ID:sta-szek,项目名称:pojo-tester,代码行数:18,代码来源:ShortValueChangerTest.java

示例11: test_getEntitiesOfGroup_ThrowsInvalidGroupExceptionWhenPassedGroupIsInvalid

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
@Test
public void test_getEntitiesOfGroup_ThrowsInvalidGroupExceptionWhenPassedGroupIsInvalid()
{
    final Group testGroup = mock(Group.class);

    when(testGroup.isInvalid()).thenReturn(true);
    when(testGroup.isValid()).thenReturn(false);

    assertThrows(InvalidGroupException.class, new Executable()
    {
        @Override
        public void execute()
        {
            testee.getEntitiesOfGroup(testGroup);
        }
    });
}
 
开发者ID:jayware,项目名称:entity-essentials,代码行数:18,代码来源:GroupManagerTest.java

示例12: Expectations

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
@Test
public void test_removeComponent_With_EntityRef_and_Class_Throws_IllegalStateException_if_the_Context_to_which_the_passed_EntityRef_belongs_to_has_been_disposed()
{
    new Expectations()
    {{
        testRef.isInvalid(); result = true;
        testRef.getContext(); result = testContext;
        testContext.isDisposed(); result = true;
    }};

    assertThrows(IllegalStateException.class, new Executable()
    {
        @Override
        public void execute()
        throws Throwable
        {
            testee.removeComponent(testRef, TestComponentA.class);
        }
    });
}
 
开发者ID:jayware,项目名称:entity-essentials,代码行数:21,代码来源:ComponentManagerImplTest.java

示例13: Should_Change_Wrapped_Value

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
private Executable Should_Change_Wrapped_Value(final Double value) {
    return () -> {
        // given
        final AllFiledTypes_Wrapped helpClass1 = new AllFiledTypes_Wrapped(value);
        final AllFiledTypes_Wrapped helpClass2 = new AllFiledTypes_Wrapped(value);

        // when
        valueChanger.changeFieldsValues(helpClass1,
                                        helpClass2,
                                        Lists.newArrayList(AllFiledTypes_Wrapped.class.getDeclaredFields()));
        final Double result1 = getInternalState(helpClass1, "doubleType");
        final Double result2 = getInternalState(helpClass2, "doubleType");

        // then
        assertThat(result1).isNotEqualTo(result2);
    };
}
 
开发者ID:sta-szek,项目名称:pojo-tester,代码行数:18,代码来源:DoubleValueChangerTest.java

示例14: Should_Change_Primitive_Value

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
private Executable Should_Change_Primitive_Value(final char value) {
    return () -> {
        // given
        final AllFiledTypes helpClass1 = new AllFiledTypes(value);
        final AllFiledTypes helpClass2 = new AllFiledTypes(value);

        // when
        valueChanger.changeFieldsValues(helpClass1,
                                        helpClass2,
                                        Lists.newArrayList(AllFiledTypes.class.getDeclaredFields()));
        final Character result1 = getInternalState(helpClass1, "characterType");
        final Character result2 = getInternalState(helpClass2, "characterType");

        // then
        assertThat(result1).isNotEqualTo(result2);
    };
}
 
开发者ID:sta-szek,项目名称:pojo-tester,代码行数:18,代码来源:CharacterValueChangerTest.java

示例15: test_addEntityToGroup_ThrowsInvalidGroupExceptionWhenPassedGroupIsInvalid

import org.junit.jupiter.api.function.Executable; //导入依赖的package包/类
@Test
public void test_addEntityToGroup_ThrowsInvalidGroupExceptionWhenPassedGroupIsInvalid()
{
    final Group testGroup = mock(Group.class);

    when(testGroup.isInvalid()).thenReturn(true);
    when(testGroup.isValid()).thenReturn(false);

    assertThrows(InvalidGroupException.class, new Executable()
    {
        @Override
        public void execute()
        {
            testee.addEntityToGroup(testEntityA, testGroup);
        }
    });
}
 
开发者ID:jayware,项目名称:entity-essentials,代码行数:18,代码来源:GroupManagerTest.java


注:本文中的org.junit.jupiter.api.function.Executable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。