Java 类org.junit.jupiter.api.Assertions 实例源码

项目:ProjectAltaria    文件:TimeUtilsTest.java   
@Test
void invalidCases() {
    assertThrows(IllegalArgumentException.class, () -> TimeUtils.abbreviate(null));

    @NotNull Class<?> clazz = TimeUtils.class;
    try {
        Constructor constructor = clazz.getDeclaredConstructor();
        assertTrue(Modifier.isPrivate(constructor.getModifiers()));
        constructor.setAccessible(true);
        try {
            constructor.newInstance();
            Assertions.fail("Private constructor should throw exception");
        } catch (InvocationTargetException t) {
            assertTrue(t.getTargetException() instanceof Error);
        }
        constructor.setAccessible(false);
    } catch (Exception e) {
        Assert.fail("No defaultConstructor");
    }
}
项目:filter-sort-jooq-api    文件:ValueTest.java   
@ParameterizedTest
@MethodSource("valuesStream")
void valueWithGetterNumberedThrowsOutOfRange(final Value value) {
    final int size = value.size();

    // No class cast exception as Value == ValueImpl (supposedly)
    if (size <= 1)
        Assertions.assertThrows(IndexOutOfBoundsException.class, ((Value2) value)::value2);

    if (size <= 2)
        Assertions.assertThrows(IndexOutOfBoundsException.class, ((Value3) value)::value3);

    if (size <= 3)
        Assertions.assertThrows(IndexOutOfBoundsException.class, ((Value4) value)::value4);

    if (size <= 4)
        Assertions.assertThrows(IndexOutOfBoundsException.class, ((Value5) value)::value5);

    if (size <= 5)
        Assertions.assertThrows(IndexOutOfBoundsException.class, ((Value6) value)::value6);
}
项目:incubator-plc4x    文件:PlcConnectionAdapterTest.java   
private static <T> void checkSupplier(int readFailureCountTrigger, MockConnection connection, Address address, Supplier<T> supplier, Object ... values) throws Exception {
  // verify that a read failure doesn't kill the consumer
  // it logs (not verified) but returns null (as designed) and keeps working for the subsequent reads
  connection.setReadException(readFailureCountTrigger, "This is a mock read exception");
  int readCount = 0;
  for (Object value : values) {
    connection.setDataValue(address, value);
    T readData = supplier.get();
    // System.out.println("checkSupplier"+(readFailureCountTrigger > 0 ? "NEG" : "")+": value:"+value+" readData:"+readData);
    if (readFailureCountTrigger <= 0)
      Assertions.assertEquals(value, readData);
    else {
      if (++readCount != readFailureCountTrigger)
        Assertions.assertEquals(value, readData);
      else
        Assertions.assertNull(readData);
    }
  }
}
项目:incubator-plc4x    文件:PlcConnectionAdapterTest.java   
@SuppressWarnings("unchecked")
private static <T> void checkConsumer(int writeFailureCountTrigger, MockConnection connection, Address address, Consumer<T> consumer, Object ... values) throws Exception {
  // verify that a write failure doesn't kill the consumer
  // it logs (not verified) but keeps working for the subsequent writes
  connection.setWriteException(writeFailureCountTrigger, "This is a mock write exception");
  int writeCount = 0;
  Object previousValue = null;
  for (Object value : values) {
    consumer.accept((T)value);
    T writtenData = (T) connection.getDataValue(address);
    if(writtenData.getClass().isArray()) {
      writtenData = (T) Array.get(writtenData, 0);
    }
    // System.out.println("checkConsumer"+(writeFailureCountTrigger > 0 ? "NEG" : "")+": value:"+value+" writtenData:"+writtenData);
    if (writeFailureCountTrigger <= 0)
      Assertions.assertEquals(value, writtenData);
    else { 
      if (++writeCount != writeFailureCountTrigger)
        Assertions.assertEquals(value, writtenData);
      else
        Assertions.assertEquals(previousValue, writtenData);
    }
    previousValue = value;
  }
}
项目:qpp-conversion-tool    文件:IaSectionEncoderTest.java   
@Test
void testEncoderWithoutMeasureValue2() {
    iaMeasurePerformedNode.putValue("measurePerformed", null);
    QppOutputEncoder encoder = new QppOutputEncoder(new Context());

    encoder.setNodes(nodes);

    StringWriter sw = new StringWriter();

    try {
        encoder.encode(new BufferedWriter(sw));
    } catch (EncodeException e) {
        Assertions.fail("Failure to encode: " + e.getMessage());
    }

    assertThat(sw.toString())
            .isEqualTo(EXPECTED_NO_MEASURE_VALUE_1);
}
项目:filter-sort-jooq-api    文件:KeyParsersTest.java   
@Test
void of6() {
    final KeyParser6<Integer, String, LocalTime, Locale, Byte, LocalDateTime> keyParser = KeyParsers.of(
        "key1", val -> 0,
        "key2", val -> "other",
        "key3", val -> LocalTime.MIDNIGHT,
        "key4", val -> Locale.ENGLISH,
        "key5", val -> (byte) 0xFF,
        "key6", val -> LocalDateTime.MAX);
    Assertions.assertEquals("key6", keyParser.key6());
    Assertions.assertEquals("key6", keyParser.getKeys()[5]);
    Assertions.assertEquals(6, keyParser.size());
    Assertions.assertEquals(6, keyParser.getKeys().length);

    Assertions.assertEquals(LocalDateTime.MAX, keyParser.parser6().apply("any"));
    Assertions.assertEquals(6, keyParser.getParsers().length);
}
项目:Shuriken    文件:DescriptorTester.java   
@Test
public void testDescriptorGenerator(){
    String desc = newDescriptor()
            .returns(void.class)
            .toString();
    String desc2 = newDescriptor()
            .returns(Void.class)
            .toString();
    String desc3 = newDescriptor()
            .accepts(int.class, int.class)
            .returns(String.class)
            .toString();
    Assertions.assertEquals("()V", desc);
    Assertions.assertEquals("()Ljava/lang/Void;", desc2); // huh?
    Assertions.assertEquals("(II)Ljava/lang/String;", desc3);
}
项目:Shuriken    文件:TestClassLoader.java   
@Test
@SuppressWarnings("unchecked")
public void testClassLoader() throws Exception {
    BrotliLibraryLoader.loadBrotli();
    String className = "eu.mikroskeem.test.shuriken.classloader.classes.TestClass1";
    Path testJar = Utils.generateTestJar(GenerateTestClass.generate());
    URL[] urls = new URL[]{ToURL.to(testJar)};
    ShurikenClassLoader cl = new ShurikenClassLoader(urls, this.getClass().getClassLoader());

    /* Find class via reflection */
    Optional<ClassWrapper<?>> optClazz = Reflect.getClass(className, cl);
    Assertions.assertTrue(optClazz.isPresent(), "Class should be present!");

    /* Try constructing that class */
    ClassWrapper<?> clazz = optClazz.get().construct();
    Assertions.assertTrue(clazz.getClassInstance().getClass() == clazz.getWrappedClass());

    /* Peek into cached classes */
    ClassWrapper<ShurikenClassLoader> clw = Reflect.wrapInstance(cl);
    FieldWrapper<Map> classesField = clw.getField("classes", Map.class).get();
    Map<String, Class<?>> classes = (Map<String, Class<?>>) classesField.read();

    Assertions.assertTrue(new ArrayList<>(classes.keySet()).get(0).equals(className));
    Assertions.assertTrue(new ArrayList<>(classes.values()).get(0) == clazz.getWrappedClass());
}
项目:Shuriken    文件:InjectorTester.java   
@Test
public void testBindingInjecting() throws Exception {
    Injector injector = ShurikenInjector.createInjector(binder -> {
       binder.bind(InterfacesTestClass.a.class).to(InterfacesTestClass.A.class);
       binder.bind(InterfacesTestClass.b.class).to(InterfacesTestClass.C.class);
    });

    TestClassTwo t1 = injector.getInstance(TestClassTwo.class);
    TestClassTwo t2 = injector.getInstance(TestClassTwo.class);

    Assertions.assertEquals("a implementer A", t1.getA().toString());
    Assertions.assertEquals("b implementer C", t1.getB().toString());
    Assertions.assertEquals("a implementer A", t2.getA().toString());
    Assertions.assertEquals("b implementer C", t2.getB().toString());
    Assertions.assertNotEquals(t1.getA(), t2.getA());
    Assertions.assertNotEquals(t1.getB(), t2.getB());
}
项目:PicoMaven    文件:ClientTest.java   
@Test
public void testDefaultBuilder() throws Exception {
    List<Dependency> dependencies = Arrays.asList(UriUtilsTest.SAMPLE_DEPENDENCY, UriUtilsTest.SAMPLE_DEPENDENCY2);
    try (
        PicoMaven picoMaven = new PicoMaven.Builder()
            .withDownloadPath(downloadDir.toPath())
            .withRepositories(Arrays.asList(MAVEN_CENTRAL_REPOSITORY, UriUtilsTest.DEFAULT_REPOSITORY2))
            .withDependencies(dependencies)
                .withDebugLoggerImpl(new DebugLoggerImpl() {
                    @Override
                    public void debug(String format, Object... contents) {
                        System.err.format(format + "\n", contents);
                    }
                })
            .build()
    ) {
        List<Path> downloadedDeps = picoMaven.downloadAll();
        Assertions.assertEquals(dependencies.size(), downloadedDeps.size());
    }
}
项目:Shuriken    文件:MethodReflectorTester.java   
@Test
public void testMixedAccessMethodReflector() {
    ClassWrapper<TestClass4> tc = wrapClass(TestClass4.class).construct();
    MethodReflector<TestClass3n4Reflector> reflector = newInstance(tc, TestClass3n4Reflector.class);

    TypeWrapper[] eParams = new TypeWrapper[] {
            TypeWrapper.of(int.class, 3),
            TypeWrapper.of("a"),
            TypeWrapper.of(char.class, 'a')
    };

    TestClass3n4Reflector reflectorImpl = reflector.getReflector();
    Assertions.assertEquals(tc.invokeMethod("a", String.class), reflectorImpl.a());
    Assertions.assertEquals(tc.invokeMethod("b", int.class).intValue(), reflectorImpl.b());
    reflectorImpl.c();
    Assertions.assertEquals(tc.invokeMethod("d", char.class).charValue(), reflectorImpl.d());
    Assertions.assertEquals(tc.invokeMethod("e", String.class, eParams), reflectorImpl.e(3, "a", 'a'));
}
项目:Shuriken    文件:MethodReflectorTester.java   
@Test
public void testInterfaceDefaultReflection() {
    ClassWrapper<TestClass8> tc = wrapClass(TestClass8.class).construct();
    MethodReflector<TestClass8Reflector> reflector = newInstance(tc, TestClass8Reflector.class);

    TestClass8Reflector reflectorImpl = reflector.getReflector();
    Assertions.assertEquals("abcd", reflectorImpl.a());
    Assertions.assertEquals("1234", reflectorImpl.b());
}
项目:filter-sort-jooq-api    文件:FilterMultipleValueParserDateTest.java   
@ParameterizedTest
@MethodSource("goodStringParsableAndResult")
void parse(final String argument, final List<LocalDate> expected) {
    Assertions.assertEquals(expected, FilterMultipleValueParser.ofDate().parse(argument));
    Assertions.assertEquals(expected.size(), FilterMultipleValueParser.ofDate().parse(argument).size());
    Assertions.assertEquals(expected, FilterMultipleValueParser.ofDate().parse(argument, ","));
}
项目:filter-sort-jooq-api    文件:FilterTest.java   
@Test
void throwWithDuplicateKeySameFilter() {
    Assertions.assertThrows(IllegalArgumentException.class, () -> Filter.of("key", "key", val1 -> "value", val2 -> "value", (value1, value2) -> DSL.trueCondition()));
    Assertions.assertThrows(IllegalArgumentException.class, () -> Filter.of("key", "key", "key3", val1 -> "value", val2 -> "value", val3 -> "value", value3 -> DSL.trueCondition()));
    Assertions.assertThrows(IllegalArgumentException.class, () -> Filter.of("key", "key2", "key", "key4", val1 -> "value", val2 -> "value", val3 -> "value", val4 -> "value", value4 -> DSL.trueCondition()));

    Assertions.assertThrows(IllegalArgumentException.class, () -> KeyParsers.ofN(
        Arrays.asList("key", "key1", "key2", "key", "key4", "key5", "key6", "key6", "key8"),
        Arrays.asList(val1 -> "value", val1 -> "value", val1 -> "value", val1 -> "value", val1 -> "value", val1 -> "value", val1 -> "value", val1 -> "value", val1 -> "value")
    ));
}
项目:filter-sort-jooq-api    文件:FilteringJooqTest.java   
@Test
@SuppressWarnings("deprecation")
void getConditionOrNull() {
    Assertions.assertNull(filteringJooqImpl1.getConditionOrNull(emptyMap, "any", s -> DSL.trueCondition()));
    Assertions.assertNull(filteringJooqImpl1.getConditionOrNull(notEmptyMap, "any", s -> DSL.trueCondition()));
    Assertions.assertNotNull(filteringJooqImpl1.getConditionOrNull(notEmptyMap, "key1", s -> DSL.trueCondition()));
    Assertions.assertNull(filteringJooqImpl1.getConditionOrNull(mapWithNullValues, "key1", s -> DSL.trueCondition()));
    Assertions.assertNull(filteringJooqImpl1.getConditionOrNull(mapWithEmptyValues, "key1", s -> DSL.trueCondition()));
    Assertions.assertNull(filteringJooqImpl1.getConditionOrNull(mapWithSpaceValues, "key1", s -> DSL.trueCondition()));
}
项目:filter-sort-jooq-api    文件:FilteringJooqTest.java   
@RepeatedTest(10)
void getFilterGetsSameFirstKeyFoundOnDuplicates() {
    filteringJooqImpl1.getFilterValues().add(Filter.of("myKey", DSL::trueCondition));
    filteringJooqImpl1.getFilterValues().add(Filter.of("myKey2", DSL::trueCondition));
    filteringJooqImpl1.getFilterValues().add(Filter.of("myKey", notParsed -> 5, val -> DSL.trueCondition()));
    final Optional<FilterValue> myKey = filteringJooqImpl1.getFilter("myKey");
    Assertions.assertTrue(myKey.isPresent());
    Assertions.assertTrue(myKey.get().isConditionSupplier());
    for (int i = 0; i < 10; i++) {
        Assertions.assertEquals(myKey.get(), filteringJooqImpl1.getFilter("myKey").get());
        Assertions.assertTrue(filteringJooqImpl1.getFilter("myKey").get().isConditionSupplier());
    }
}
项目:Just-Evaluator    文件:LessThanOpTest.java   
@Test
void testLTCompiler() {
    String result = compiler("123 < 123 ", null);
    Assertions.assertFalse(Boolean.valueOf(result));

    result = compiler("123.111111d < 111.111111d", null);
    Assertions.assertFalse(Boolean.valueOf(result));
}
项目:Just-Evaluator    文件:ArrayIndexExprTest.java   
@Test
void testObjectArrayIndexExpr() {
    JustContext context = new JustMapContext();
    Integer[][] lfkdsk = new Integer[][]{{1, 2}, {2, 3}, {2, 10}};
    context.put("lfkdsk", lfkdsk);
    String returnStr = runExpr("lfkdsk[2][1]", true, context);
    Assertions.assertEquals((int) Integer.valueOf(returnStr), 10);
}
项目:Just-Evaluator    文件:NegativePostfixTest.java   
@Test
void negativeCompiler() {
    JustContext context = new JustMapContext();
    context.put("lfkdsk", 100);
    String result = compiler("- lfkdsk ", context);
    Assertions.assertEquals(Integer.parseInt(result), -100);
}
项目:Just-Evaluator    文件:ExtendFunctionExprTest.java   
@Test
void testExtendFuncCompiler() {
    Logger.init();
    ExtendFunc func = new ExtendFunc();
    JustContext context = new JustMapContext();
    context.putExtendFunc(func);
    String returnStr = compiler("add(1111,2222)", context);
    Assertions.assertEquals((int) Integer.valueOf(returnStr), 3333);
}
项目:filter-sort-jooq-api    文件:FilterParserLocalDateTimeTest.java   
@Test
void parseOrDefault() {
    final LocalDateTime result = FilterParser.ofDateTime().parseOrDefault(correctFormatDate1, date1);
    Assertions.assertEquals(date1, result);

    final LocalDateTime result2 = FilterParser.ofDateTime().parseOrDefault(correctFormatDate2, date2);
    Assertions.assertEquals(date2, result2);
}
项目:qpp-conversion-tool    文件:RegistryTest.java   
@Test
void testRegistryGetHandlerWithNoArgThrowableConstructor() {
    Assertions.assertThrows(SevereRuntimeException.class, () -> {
        registry.register(new ComponentKey(TemplateId.PLACEHOLDER, Program.ALL), NoArgThrowableConstructor.class);
        registry.get(TemplateId.PLACEHOLDER);
    });
}
项目:weld-junit    文件:ExplicitParameterInjectionViaPropertyTest.java   
@Test
@ExtendWith(CustomExtension.class)
public void testParametersNeedExtraAnnotation(@Default Foo foo, Bar bar, @MyQualifier BeanWithQualifier bean) {
    // Bar should be resolved by another extension
    Assertions.assertNotNull(bar);
    Assertions.assertEquals(CustomExtension.class.getSimpleName(), bar.ping());
    // Foo should be resolved as usual
    Assertions.assertNotNull(foo);
    Assertions.assertEquals(Foo.class.getSimpleName(), foo.ping());
    // BeanWithQualifier should be resolved
    Assertions.assertNotNull(bean);
    Assertions.assertEquals(BeanWithQualifier.class.getSimpleName(), bean.ping());
}
项目:filter-sort-jooq-api    文件:FilterParserByteTest.java   
@Test
void parse() {
    Assertions.assertEquals(10, (byte) FilterParser.ofByte().parse("10"));
    Assertions.assertEquals(0x0F, (byte) FilterParser.ofByte().parse("15"));
    Assertions.assertEquals(127, (byte) FilterParser.ofByte().parse("127"));
    Assertions.assertEquals(0, (byte) FilterParser.ofByte().parse("0"));
    Assertions.assertEquals(1, (byte) FilterParser.ofByte().parse("1"));
}
项目:Shuriken    文件:ClassWrapperTester.java   
@Test
public void testClassConstructingWithInvalidArgs() throws Exception {
    Class<TestClassTwo> testClass = TestClassTwo.class;
    ClassWrapper<TestClassTwo> cw = Reflect.wrapClass(testClass);
    NoSuchMethodException e = Assertions.assertThrows(NoSuchMethodException.class, ()->{
        Reflect.construct(cw, of(1));
    });
    Assertions.assertNull(cw.getClassInstance(), "Class instance should be null!");
}
项目:filter-sort-jooq-api    文件:FilterMultipleValueParserDateTest.java   
@Test
void noValuesThrows() {
    Assertions.assertThrows(FilteringApiException.class, () -> FilterMultipleValueParser.ofDate().parse(""));
    Assertions.assertThrows(FilteringApiException.class, () -> FilterMultipleValueParser.ofDate().parse("", 3));
    Assertions.assertThrows(FilteringApiException.class, () -> FilterMultipleValueParser.ofDate().parse("", "::"));
    Assertions.assertThrows(FilteringApiException.class, () -> FilterMultipleValueParser.ofDate().parse("", "--", 3));
}
项目:filter-sort-jooq-api    文件:FilterParserByteTest.java   
@Test
void parseOrDefaultWithSupplier() {
    final byte result = FilterParser.ofByte().parseOrDefault("5", () -> (byte) 0xA);
    Assertions.assertEquals(5, result);

    final byte result2 = FilterParser.ofByte().parseOrDefault("-12", () -> (byte) 0xA);
    Assertions.assertEquals(-12, result2);

    final byte result3 = FilterParser.ofByte().parseOrDefault("0000", () -> (byte) 0xA);
    Assertions.assertEquals(0, result3);
}
项目:filter-sort-jooq-api    文件:SortValueTest.java   
@Test
void getSortNullFirst() {
    final SortField sortFieldNullFirstAscInt = intSortValue.getSortFieldNullFirst(SortOrder.ASC);
    final SortField sortFieldNullFirstDescInt = intSortValue.getSortFieldNullFirst(SortOrder.DESC);

    final SortField sortFieldNullFirstAscString = stringSortValue.getSortFieldNullFirst(SortOrder.ASC);
    final SortField sortFieldNullFirstDescString = stringSortValue.getSortFieldNullFirst(SortOrder.DESC);

    Assertions.assertNotNull(sortFieldNullFirstAscInt);
    Assertions.assertNotNull(sortFieldNullFirstDescInt);
    Assertions.assertNotNull(sortFieldNullFirstAscString);
    Assertions.assertNotNull(sortFieldNullFirstDescString);
}
项目:Just-Evaluator    文件:ExtendFunctionExprTest.java   
@Test
void testExtendFunc() {
    ExtendFunc func = new ExtendFunc();
    String returnStr = runExpr("add(1111,2222)",
            true,
            new JustMapContext() {{
                putExtendFunc(func);
            }});
    Assertions.assertEquals((int) Integer.valueOf(returnStr), 3333);
}
项目:BlockBall    文件:PlayerMetaSQLiteControllerTest.java   
@Test
public void storeLoadPlayerMetaTest() throws ClassNotFoundException {
    Factory.initialize(mockPlugin());
    try (PlayerMetaController controller = Factory.createPlayerDataController()) {
        for (final PlayerMeta item : controller.getAll()) {
            controller.remove(item);
        }
        UUID uuid = UUID.randomUUID();
        PlayerMeta playerMeta = new PlayerData();
        playerMeta.setName("Second");
        playerMeta.setUuid(uuid);
        controller.store(playerMeta);

        assertEquals(1, controller.size());
        playerMeta = controller.getAll().get(0);
        assertEquals(uuid, playerMeta.getUUID());
        assertEquals("Second", playerMeta.getName());

        uuid = UUID.randomUUID();
        playerMeta.setName("Shynixn");
        playerMeta.setUuid(uuid);
        controller.store(playerMeta);

        playerMeta = controller.getAll().get(0);
        assertEquals(uuid, playerMeta.getUUID());
        assertEquals("Shynixn", playerMeta.getName());
    } catch (final Exception e) {
        Logger.getLogger(this.getClass().getSimpleName()).log(Level.WARNING, "Failed to run test.", e);
        Assertions.fail(e);
    }
}
项目:filter-sort-jooq-api    文件:FilterParserLocalDateTimeTest.java   
@Test
void parseOrDefaultWithSupplierBadInput() {
    final LocalDateTime result = FilterParser.ofDateTime().parseOrDefault("2017-04-06", () -> now);
    Assertions.assertEquals(now, result);

    final LocalDateTime result2 = FilterParser.ofDateTime().parseOrDefault("2017-04-O6    12:02:92", () -> now);
    Assertions.assertEquals(now, result2);

    final LocalDateTime result3 = FilterParser.ofDateTime().parseOrDefault("   8   ", () -> now);
    Assertions.assertEquals(now, result3);
}
项目:Shuriken    文件:EnsureTester.java   
@Test
public void testFalseCondition() throws Exception {
    UnsupportedOperationException e = Assertions.assertThrows(UnsupportedOperationException.class, () ->
        Ensure.ensureCondition(false, UnsupportedOperationException.class, of("foo"))
    );
    Assertions.assertEquals("foo", e.getMessage(), "Exception message didn't match!");
}
项目:java-champion-gg-wrapper    文件:DeSerializerTest.java   
@Test void testGsonProvider() {
    Assert.assertNotNull("gson provider did not provide a gson builder", GsonProvider.getGsonBuilder());
    Assert.assertNotNull("gson provider did not provide a gson instance", GsonProvider.getGson());
    Assert.assertEquals("gson provider did not provide the same gson instance twice",
        GsonProvider.getGson(), GsonProvider.getGson());

    Assertions.assertThrows(UnsupportedOperationException.class, GsonProvider::new);
}
项目:roboslack    文件:WebHookTokenTests.java   
@Test
void testFromEnvironment() {
    List<String> keysMissingFromEnvironment = WebHookToken.Env.missingTokenKeys();
    Assumptions.assumeTrue(keysMissingFromEnvironment.isEmpty(),
            () -> String.format("Skipping test, environment keys not found: [%s]",
                    Joiner.on(", ").join(keysMissingFromEnvironment)));
    WebHookToken token = WebHookToken.fromEnvironment();
    Assertions.assertFalse(Strings.isNullOrEmpty(token.partB()));
    Assertions.assertFalse(Strings.isNullOrEmpty(token.partT()));
    Assertions.assertFalse(Strings.isNullOrEmpty(token.partX()));
    Assertions.assertFalse(Strings.isNullOrEmpty(token.toString()));
}
项目:Shuriken    文件:MethodReflectionTester.java   
@Test
public void testClassPrimitiveArrayMethodInvoke() throws Exception {
    ClassWrapper<TestClassFour> cw = Reflect.wrapClass(TestClassFour.class);
    double[] expected = new double[]{-1, -1, -1};
    double[] actual = cw.invokeMethod("get", double[].class);
    Assertions.assertArrayEquals(expected, actual);
}
项目:filter-sort-jooq-api    文件:SortValueTest.java   
@Test
void sortValueWorksWithCreatedField() {
    final SortValue ofInt = SortValue.of(intField);
    final SortValue ofString = SortValue.of(stringField);

    Assertions.assertNotNull(ofInt);
    Assertions.assertNotNull(ofString);
}
项目:ExZiff    文件:ChunkSectionTranscoderTest.java   
public static void assertEqualsChunkSection(ChunkSection chunkSection1, ChunkSection chunkSection2)
{
    for(int icsY = 0; icsY < ChunkSection.HEIGHT; icsY++)
        for(int icsZ = 0; icsZ < Chunk.WIDTH; icsZ++)
            for(int icsX = 0; icsX < Chunk.WIDTH; icsX++)
            {
                Assertions.assertEquals(chunkSection1.getMaterialId(icsX, icsY, icsZ),
                        chunkSection2.getMaterialId(icsX, icsY, icsZ),
                        "Difference in chunk section materialId at x"+icsX+" y"+icsY+" z"+icsZ);

                Assertions.assertEquals(chunkSection1.getMaterialSubId(icsX, icsY, icsZ),
                        chunkSection2.getMaterialSubId(icsX, icsY, icsZ),
                        "Difference in chunk section materialSubId at x"+icsX+" y"+icsY+" z"+icsZ);
            }
}
项目:Shuriken    文件:MethodReflectorTester.java   
@Test
public void testReflectiveConstructionOnNonPublicClass() {
    ClassWrapper<?> tc = Reflect.getClass(TestClass9.class.getPackage().getName() + ".TestClass11").orElse(null);
    MethodReflector<TestClass11Reflector> reflector = newInstance(tc, TestClass11Reflector.class);

    TestClass11Reflector reflectorImpl = reflector.getReflector();
    Object tc11Ref = reflectorImpl.New();
    Assertions.assertNotNull(tc11Ref);
    Assertions.assertEquals(tc.getWrappedClass(), tc11Ref.getClass());
}
项目:Just-Evaluator    文件:GreaterThanOpTest.java   
@Test
    void testGTCompiler() {
//        String result = compiler(" \"lfkdsk\" > \"lfk\" ", null);
//        Assertions.assertTrue(Boolean.valueOf(result));

        String result = compiler("123.111111d > 111.111111d", null);
        Assertions.assertTrue(Boolean.valueOf(result));

        result = compiler("123 > 123 ", null);
        Assertions.assertFalse(Boolean.valueOf(result));

    }
项目:JLoopix    文件:SphinxParamsTest.java   
@Test
void testLionessEncThenDecEqual() {
    try {
        SphinxParams params = new SphinxParams();
        byte[] key = "AAAAAAAAAAAAAAAA".getBytes(Charset.forName("UTF-8"));
        byte[] message = "ARGARGARGARGARGARGARGARGARGARGARGARGARGARGARGARG".getBytes(Charset.forName("UTF-8"));
        byte[] ciphertext = params.lionessEnc(key, message);
        byte[] decMessage = params.lionessDec(key, ciphertext);
        Assertions.assertTrue(Arrays.equals(message, decMessage));
    } catch (CryptoException e) {
        throw new Error("Exception thrown when not expected", e);
    }
}