类org.junit.jupiter.api.DisplayName源码实例Demo

下面列出了怎么用org.junit.jupiter.api.DisplayName的API类实例代码及写法,或者点击链接到github查看源代码。

@Test
@DisplayName("return a value either from non-empty Optional or from a Supplier")
@Tag("PASSING")
@Order(3)
public void orElseGetSupplierValue() {

    String defaultOptional = "supplied";
    Optional<String> anOptional = Optional.empty();

    /*
     * DONE:
     *  Replace the below to use an orElseGet(?) - instead of - the or(?)
     *  and the need to use get()
     *  Check API: java.util.Optional.ofNullable(?)
     */
    String nonNullString = anOptional.orElseGet(() -> defaultOptional);

    assertTrue(nonNullString instanceof String,
            "The nonNullString should be an instance of String");

    assertEquals(nonNullString,
            "supplied",
            "The nonNullString should have a value of \"supplied\"");
}
 
源代码2 项目: mongo-kafka   文件: MongoDbUpdateTest.java
@Test
@DisplayName(
    "when valid doc change cdc event containing internal oplog fields then correct UpdateOneModel")
public void testValidSinkDocumentWithInternalOploagFieldForUpdate() {
  BsonDocument keyDoc = BsonDocument.parse("{id: '1234'}");
  BsonDocument valueDoc =
      new BsonDocument("op", new BsonString("u"))
          .append("patch", new BsonString(UPDATE_DOC_WITH_OPLOG_INTERNALS.toJson()));

  WriteModel<BsonDocument> result = UPDATE.perform(new SinkDocument(keyDoc, valueDoc));
  assertTrue(
      result instanceof UpdateOneModel, () -> "result expected to be of type UpdateOneModel");

  UpdateOneModel<BsonDocument> writeModel = (UpdateOneModel<BsonDocument>) result;
  assertEquals(
      UPDATE_DOC, writeModel.getUpdate(), () -> "update doc not matching what is expected");
  assertTrue(
      writeModel.getFilter() instanceof BsonDocument,
      () -> "filter expected to be of type BsonDocument");
  assertEquals(FILTER_DOC, writeModel.getFilter());
}
 
源代码3 项目: mongo-kafka   文件: IdStrategyTest.java
@Test
@DisplayName("test PartialKeyStrategy with Allow List")
void testPartialKeyStrategyAllowList() {
  BsonDocument keyDoc = BsonDocument.parse("{keyPart1: 123, keyPart2: 'ABC', keyPart3: true}");
  BsonDocument expected = BsonDocument.parse("{keyPart1: 123}");

  MongoSinkTopicConfig cfg =
      createTopicConfig(
          format(
              "{'%s': '%s', '%s': 'keyPart1'}",
              DOCUMENT_ID_STRATEGY_PARTIAL_KEY_PROJECTION_TYPE_CONFIG,
              ALLOWLIST,
              DOCUMENT_ID_STRATEGY_PARTIAL_KEY_PROJECTION_LIST_CONFIG));

  IdStrategy ids = new PartialKeyStrategy();
  ids.configure(cfg);
  SinkDocument sd = new SinkDocument(keyDoc, null);
  BsonValue id = ids.generateId(sd, null);

  assertAll(
      "id checks",
      () -> assertTrue(id instanceof BsonDocument),
      () -> assertEquals(expected, id.asDocument()));
  assertEquals(new BsonDocument(), ids.generateId(new SinkDocument(null, null), null));
}
 
源代码4 项目: chart-fx   文件: BinarySerialiserTests.java
@DisplayName("test getGenericArrayAsBoxedPrimitive(...) helper method")
@ParameterizedTest(name = "IoBuffer class - {0}")
@ValueSource(classes = { FastByteBuffer.class, ByteBuffer.class })
public void testgetGenericArrayAsBoxedPrimitiveHelper(final Class<? extends IoBuffer> bufferClass) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
    assertNotNull(bufferClass, "bufferClass being not null");
    assertNotNull(bufferClass.getConstructor(int.class), "Constructor(Integer) present");
    final IoBuffer buffer = bufferClass.getConstructor(int.class).newInstance(2 * BUFFER_SIZE); // a bit larger buffer since we test more cases at once

    putGenericTestArrays(buffer);

    buffer.reset();

    // test conversion to double array
    assertThrows(IllegalArgumentException.class, () -> BinarySerialiser.getGenericArrayAsBoxedPrimitive(buffer, DataType.OTHER));

    assertArrayEquals(new Boolean[] { true, false, true }, BinarySerialiser.getGenericArrayAsBoxedPrimitive(buffer, DataType.BOOL));
    assertArrayEquals(new Byte[] { (byte) 1.0, (byte) 0.0, (byte) 2.0 }, BinarySerialiser.getGenericArrayAsBoxedPrimitive(buffer, DataType.BYTE));
    assertArrayEquals(new Character[] { (char) 1.0, (char) 0.0, (char) 2.0 }, BinarySerialiser.getGenericArrayAsBoxedPrimitive(buffer, DataType.CHAR));
    assertArrayEquals(new Short[] { (short) 1.0, (short) 0.0, (short) 2.0 }, BinarySerialiser.getGenericArrayAsBoxedPrimitive(buffer, DataType.SHORT));
    assertArrayEquals(new Integer[] { (int) 1.0, (int) 0.0, (int) 2.0 }, BinarySerialiser.getGenericArrayAsBoxedPrimitive(buffer, DataType.INT));
    assertArrayEquals(new Long[] { (long) 1.0, (long) 0.0, (long) 2.0 }, BinarySerialiser.getGenericArrayAsBoxedPrimitive(buffer, DataType.LONG));
    assertArrayEquals(new Float[] { 1.0f, 0.0f, 2.0f }, BinarySerialiser.getGenericArrayAsBoxedPrimitive(buffer, DataType.FLOAT));
    assertArrayEquals(new Double[] { 1.0, 0.0, 2.0 }, BinarySerialiser.getGenericArrayAsBoxedPrimitive(buffer, DataType.DOUBLE));
    assertArrayEquals(new String[] { "1.0", "0.0", "2.0" }, BinarySerialiser.getGenericArrayAsBoxedPrimitive(buffer, DataType.STRING));
}
 
源代码5 项目: chart-fx   文件: IirFilterTests.java
@DisplayName("Butterworth - High-Pass")
@ParameterizedTest(name = "{displayName}: filter-order: {0}, algorithm: {1}")
@CsvSource({ "2, 0", "3, 0", "4, 0", "2, 1", "3, 1", "4, 1", "2, 2", "3, 2", "4, 2" })
public void testButterworthHighPass(final int filterOrder, final int algorithmVariant) {
    final Butterworth iirHighPass = new Butterworth();
    switch (algorithmVariant) {
    case 1:
        iirHighPass.highPass(filterOrder, 1.0, F_CUT_HIGH, DirectFormAbstract.DIRECT_FORM_I);
        break;
    case 2:
        iirHighPass.highPass(filterOrder, 1.0, F_CUT_HIGH, DirectFormAbstract.DIRECT_FORM_II);
        break;
    case 0:
    default:
        iirHighPass.highPass(filterOrder, 1.0, F_CUT_HIGH);
        break;
    }

    final DataSet magHighPass = filterAndGetMagnitudeSpectrum(iirHighPass, demoDataSet);
    assertThat("high-pass cut-off", magHighPass.getValue(DIM_X, F_CUT_HIGH), lessThan(-3.0 + EPSILON_DB));
    assertThat("high-pass rejection", magHighPass.getValue(DIM_X, 0.1 * F_CUT_HIGH), lessThan(-3.0 + EPSILON_DB - 20 * filterOrder));
    assertThat("high-pass pass-band ripple", getRange(magHighPass, (int) (N_SAMPLES_FFT * 0.95), N_SAMPLES_FFT), lessThan(EPSILON_DB));
}
 
源代码6 项目: mongo-kafka   文件: SinkDocumentTest.java
@Test
@DisplayName("test SinkDocument clone with missing key / value")
void testCloneNoKeyValue() {

  SinkDocument orig = new SinkDocument(null, null);

  assertAll(
      "orig key/value docs NOT present",
      () -> assertFalse(orig.getKeyDoc().isPresent()),
      () -> assertFalse(orig.getValueDoc().isPresent()));

  SinkDocument clone = orig.clone();

  assertAll(
      "clone key/value docs NOT present",
      () -> assertFalse(clone.getKeyDoc().isPresent()),
      () -> assertFalse(clone.getValueDoc().isPresent()));
}
 
@Test
@DisplayName("create an Optional from a variable")
@Tag("TODO")
@Order(2)
public void createOptionalFromValue() {

    Integer anInteger = 10;

    /*
     * TODO:
     *  Replace the "null" to create an Optional for anInteger.
     *  Check API: java.util.Optional.of(?)
     */
    Optional<Integer> optionalForInteger = null;

    assertTrue(optionalForInteger instanceof Optional,
            "The optionalEmptyString should be an instance of Optional");

    assertFalse(optionalForInteger.isEmpty(),
            "The optionalForInteger should not be empty");
}
 
源代码8 项目: chart-fx   文件: BinarySerialiserTests.java
@DisplayName("test getDoubleArray([boolean[], byte[], ..., String[]) helper method")
@ParameterizedTest(name = "IoBuffer class - {0}")
@ValueSource(classes = { FastByteBuffer.class, ByteBuffer.class })
public void testGetDoubleArrayHelper(final Class<? extends IoBuffer> bufferClass) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
    assertNotNull(bufferClass, "bufferClass being not null");
    assertNotNull(bufferClass.getConstructor(int.class), "Constructor(Integer) present");
    final IoBuffer buffer = bufferClass.getConstructor(int.class).newInstance(2 * BUFFER_SIZE); // a bit larger buffer since we test more cases at once

    putGenericTestArrays(buffer);

    buffer.reset();

    // test conversion to double array
    assertThrows(IllegalArgumentException.class, () -> BinarySerialiser.getDoubleArray(buffer, DataType.OTHER));
    assertArrayEquals(new double[] { 1.0, 0.0, 1.0 }, BinarySerialiser.getDoubleArray(buffer, DataType.BOOL_ARRAY));
    assertArrayEquals(new double[] { 1.0, 0.0, 2.0 }, BinarySerialiser.getDoubleArray(buffer, DataType.BYTE_ARRAY));
    assertArrayEquals(new double[] { 1.0, 0.0, 2.0 }, BinarySerialiser.getDoubleArray(buffer, DataType.CHAR_ARRAY));
    assertArrayEquals(new double[] { 1.0, 0.0, 2.0 }, BinarySerialiser.getDoubleArray(buffer, DataType.SHORT_ARRAY));
    assertArrayEquals(new double[] { 1.0, 0.0, 2.0 }, BinarySerialiser.getDoubleArray(buffer, DataType.INT_ARRAY));
    assertArrayEquals(new double[] { 1.0, 0.0, 2.0 }, BinarySerialiser.getDoubleArray(buffer, DataType.LONG_ARRAY));
    assertArrayEquals(new double[] { 1.0, 0.0, 2.0 }, BinarySerialiser.getDoubleArray(buffer, DataType.FLOAT_ARRAY));
    assertArrayEquals(new double[] { 1.0, 0.0, 2.0 }, BinarySerialiser.getDoubleArray(buffer, DataType.DOUBLE_ARRAY));
    assertArrayEquals(new double[] { 1.0, 0.0, 2.0 }, BinarySerialiser.getDoubleArray(buffer, DataType.STRING_ARRAY));
}
 
源代码9 项目: mongo-kafka   文件: RdbmsDeleteTest.java
@Test
@DisplayName("when valid cdc event with single field PK then correct DeleteOneModel")
void testValidSinkDocumentSingleFieldPK() {
  BsonDocument filterDoc = BsonDocument.parse("{_id: {id: 1004}}");
  BsonDocument keyDoc = BsonDocument.parse("{id: 1004}");
  BsonDocument valueDoc = BsonDocument.parse("{op: 'd'}");

  WriteModel<BsonDocument> result = RDBMS_DELETE.perform(new SinkDocument(keyDoc, valueDoc));
  assertTrue(result instanceof DeleteOneModel, "result expected to be of type DeleteOneModel");

  DeleteOneModel<BsonDocument> writeModel = (DeleteOneModel<BsonDocument>) result;
  assertTrue(
      writeModel.getFilter() instanceof BsonDocument,
      "filter expected to be of type BsonDocument");
  assertEquals(filterDoc, writeModel.getFilter());
}
 
源代码10 项目: mongo-kafka   文件: WriteModelStrategyTest.java
@Test
@DisplayName(
    "when sink document is valid for DeleteOneDefaultStrategy then correct DeleteOneModel")
void testDeleteOneDefaultStrategyWitValidSinkDocument() {

  BsonDocument keyDoc = BsonDocument.parse("{id: 1234}");

  WriteModel<BsonDocument> result =
      DELETE_ONE_DEFAULT_STRATEGY.createWriteModel(new SinkDocument(keyDoc, null));

  assertTrue(result instanceof DeleteOneModel, "result expected to be of type DeleteOneModel");

  DeleteOneModel<BsonDocument> writeModel = (DeleteOneModel<BsonDocument>) result;

  assertTrue(
      writeModel.getFilter() instanceof BsonDocument,
      "filter expected to be of type BsonDocument");

  assertEquals(FILTER_DOC_DELETE_DEFAULT, writeModel.getFilter());
}
 
源代码11 项目: java-xray-tracer   文件: AWSXRayTracerTests.java
@Test
@DisplayName("store a reference to the current span")
void storeReference() {
    final Scope scope = tracer
        .buildSpan("simple-span")
        .startActive(true);

    assertNotNull(tracer.activeSpan());
    assertNotNull(tracer.scopeManager().active().span());

    assertEquals(tracer.activeSpan(), scope.span());
    assertEquals(tracer.scopeManager().active().span(), scope.span());

    scope.close();
}
 
源代码12 项目: mongo-kafka   文件: MongoDbHandlerTest.java
@Test
@DisplayName("when value doc contains unmapped operation type then DataException")
void testUnmappedCdcOperationType() {
  SinkDocument cdcEvent =
      new SinkDocument(
          new BsonDocument("_id", new BsonInt32(1234)),
          new BsonDocument("op", new BsonString("c"))
              .append("after", new BsonString("{_id:1234,foo:\"blah\"}")));

  assertThrows(DataException.class, () -> HANDLER_EMPTY_MAPPING.handle(cdcEvent));
}
 
源代码13 项目: sureness   文件: AuthUserRoleBindDaoTest.java
@DisplayName("删除数据Bind应成功")
@Test
@Transactional
public void shouldSuccessWhenDeleteBind() {
    AuthUserRoleBindDO userRoleBind = AuthUserRoleBindDO.builder()
            .userId(123L).roleId(232L).build();
    userRoleBind = userRoleBindDao.save(userRoleBind);
    userRoleBindDao.delete(userRoleBind);
    Assertions.assertThat(userRoleBindDao.findById(userRoleBind.getId()).isPresent()).isFalse();
}
 
源代码14 项目: org.hl7.fhir.core   文件: Base64BinaryTypeTest.java
@Test
@DisplayName("Valid Base64 String creates non-null instance with non-null values.")
public void testValid() {
  String v = "dGhpcyBpcyB2YWxpZCBiYXNlNjQ=";
  Base64BinaryType b64 = new Base64BinaryType(v);
  Assertions.assertNotNull(b64);
  Assertions.assertNotNull(b64.getValue());
  Assertions.assertEquals(v, b64.asStringValue());
}
 
源代码15 项目: mongo-kafka   文件: MongoSourceConnectorTest.java
@Test
@DisplayName("Ensure source loads data from MongoClient with copy existing data")
void testSourceLoadsDataFromMongoClientWithCopyExisting() {
  assumeTrue(isGreaterThanThreeDotSix());
  Properties sourceProperties = new Properties();
  sourceProperties.put(MongoSourceConfig.COPY_EXISTING_CONFIG, "true");
  addSourceConnector(sourceProperties);

  MongoDatabase db1 = getDatabaseWithPostfix();
  MongoDatabase db2 = getDatabaseWithPostfix();
  MongoDatabase db3 = getDatabaseWithPostfix();
  MongoCollection<Document> coll1 = db1.getCollection("coll");
  MongoCollection<Document> coll2 = db2.getCollection("coll");
  MongoCollection<Document> coll3 = db3.getCollection("coll");
  MongoCollection<Document> coll4 = db1.getCollection("db1Coll2");

  insertMany(rangeClosed(1, 50), coll1, coll2);

  assertAll(
      () -> assertProduced(createInserts(1, 50), coll1),
      () -> assertProduced(createInserts(1, 50), coll2),
      () -> assertProduced(emptyList(), coll3));

  db1.drop();
  insertMany(rangeClosed(51, 60), coll2, coll4);
  insertMany(rangeClosed(1, 70), coll3);

  assertAll(
      () ->
          assertProduced(
              concat(createInserts(1, 50), singletonList(createDropCollection())), coll1),
      () -> assertProduced(createInserts(1, 60), coll2),
      () -> assertProduced(createInserts(1, 70), coll3),
      () -> assertProduced(createInserts(51, 60), coll4));
}
 
源代码16 项目: JsonTemplate   文件: IntegerValueProducerTest.java
@Test
@DisplayName("generate a integer string with max parameter")
void testProduceWithParamMax() {
    Map<String, String> mapParam = new HashMap<>();
    int max = 80;
    mapParam.put("max", Integer.toString(max));

    String producedValue = producer.produce(mapParam).compactString();
    int parsedInt = Integer.parseInt(producedValue);

    assertThat(parsedInt, lessThanOrEqualTo(max));
}
 
源代码17 项目: java-xray-tracer   文件: AWSXRaySpanTests.java
@Test
@DisplayName("set IS_SAMPLED tag on underlying Entity")
void tagSampled() {
    final AWSXRaySpan span = mockSpan("test-tag-is-sampled");
    assertTrue(span.getEntity() instanceof Segment);

    span.setTag(AWSXRayTags.IS_SAMPLED.getKey(), false);
    assertFalse(((Segment) span.getEntity()).isSampled());

    span.setTag(AWSXRayTags.IS_SAMPLED.getKey(), true);
    assertTrue(((Segment) span.getEntity()).isSampled());
}
 
源代码18 项目: mongo-kafka   文件: MongoDbHandlerTest.java
@Test
@DisplayName("when value doc contains operation type other than string then DataException")
void testInvalidCdcOperationType() {
  SinkDocument cdcEvent =
      new SinkDocument(
          new BsonDocument("id", new BsonInt32(1234)),
          new BsonDocument("op", new BsonInt32('c')));

  assertThrows(DataException.class, () -> HANDLER_DEFAULT_MAPPING.handle(cdcEvent));
}
 
源代码19 项目: hedera-mirror-node   文件: EntityIdTest.java
@DisplayName("Convert String to EntityId")
@Test
void ofStringPositive() {
    EntityTypeEnum type = EntityTypeEnum.ACCOUNT;
    assertThat(EntityId.of("0.0.1", type)).isEqualTo(EntityId.of(0, 0, 1, type));
    assertThat(EntityId.of("0.0.0", type)).isNull();
}
 
源代码20 项目: org.hl7.fhir.core   文件: ValidatorGuiTest.java
@Test
@DisplayName("Page boots correctly, and displays index.html")
public void UI_contains_correct_heading() throws IOException {
  ValidatorGui.start(new CliContext(), null, false);
  WebDriverManager.chromedriver().setup();
  ChromeOptions options = new ChromeOptions();
  options.addArguments("--headless");
  options.addArguments("--disable-gpu");
  WebDriver driver = new ChromeDriver(options);
  driver.get("http://localhost:" + ValidatorGui.getPort() + "/home");

  Assertions.assertTrue(driver.getPageSource().contains(HTML_TITLE_TAG));
  driver.quit();
  ValidatorGui.stop();
}
 
源代码21 项目: chart-fx   文件: IirFilterTests.java
@DisplayName("ChebyshevII - Band-Pass")
@ParameterizedTest(name = "{displayName}: filter-order: {0}, algorithm: {1}")
@CsvSource({ "2, 0", "3, 0", "4, 0", "2, 1", "3, 1", "4, 1", "2, 2", "3, 2", "4, 2" })
public void testChebyshevIILBandPass(final int filterOrder, final int algorithmVariant) {
    final ChebyshevII iirBandPass = new ChebyshevII();
    switch (algorithmVariant) {
    case 1:
        iirBandPass.bandPass(filterOrder, 1.0, F_BAND_CENTRE, F_BAND_WIDTH, ALLOWED_OUT_OF_BAND_RIPPLE_DB, DirectFormAbstract.DIRECT_FORM_I);
        break;
    case 2:
        iirBandPass.bandPass(filterOrder, 1.0, F_BAND_CENTRE, F_BAND_WIDTH, ALLOWED_OUT_OF_BAND_RIPPLE_DB, DirectFormAbstract.DIRECT_FORM_II);
        break;
    case 0:
    default:
        iirBandPass.bandPass(filterOrder, 1.0, F_BAND_CENTRE, F_BAND_WIDTH, ALLOWED_OUT_OF_BAND_RIPPLE_DB);
        break;
    }

    final DataSet magBandPass = filterAndGetMagnitudeSpectrum(iirBandPass, demoDataSet);
    assertThat("band-pass cut-off (low)", magBandPass.getValue(DIM_X, F_BAND_START), lessThan(ALLOWED_OUT_OF_BAND_RIPPLE_DB + EPSILON_DB));
    assertThat("band-pass cut-off (high)", magBandPass.getValue(DIM_X, F_BAND_STOP), lessThan(ALLOWED_OUT_OF_BAND_RIPPLE_DB + EPSILON_DB));
    assertThat("band-pass rejection (low)", magBandPass.getValue(DIM_X, 0.1 * F_BAND_START), lessThan(ALLOWED_OUT_OF_BAND_RIPPLE_DB + EPSILON_DB));
    assertThat("band-pass rejection (high)", magBandPass.getValue(DIM_X, 10 * F_BAND_STOP), lessThan(ALLOWED_OUT_OF_BAND_RIPPLE_DB + EPSILON_DB));
    final double rangePassBand = getRange(magBandPass,
            magBandPass.getIndex(DIM_X, (F_BAND_CENTRE - 0.1 * F_BAND_WIDTH)),
            magBandPass.getIndex(DIM_X, (F_BAND_CENTRE + 0.1 * F_BAND_WIDTH)));
    assertThat("band-pass pass-band ripple", rangePassBand, lessThan(ALLOWED_IN_BAND_RIPPLE_DB + EPSILON_DB));
}
 
源代码22 项目: mongo-kafka   文件: MongoSinkTaskTest.java
@Test
@DisplayName("test with default config and no sink records")
void testBuildWriteModelDefaultConfigSinkRecordsAbsent() {
  List<? extends WriteModel> writeModelList =
      new MongoSinkTask().buildWriteModel(createTopicConfig(), emptyList());

  assertNotNull(writeModelList, "WriteModel list was null");
  assertEquals(emptyList(), writeModelList, "WriteModel list mismatch");
}
 
源代码23 项目: MergeProcessor   文件: GITMergeUnitTest.java
@DisplayName("Tests compareTo() using 2 equal GITMergeUnits with different file names")
@Test
public void testCompareToWithEqualMergeUnitButDifferentFileNames() {
	final LocalDateTime date = LocalDateTime.now();
	final GITMergeUnit unit1 = new GITMergeUnit(DEFAULT_TEST_HOST, DEFAULT_REPOSITORY, date, DEFAULT_COMMIT_ID,
			DEFAULT_BRANCH_SOURCE, DEFAULT_BRANCH_TARGET, DEFAULT_FILE_NAME, new ArrayList<>(0),
			new JUnitConfiguration());
	final GITMergeUnit unit = new GITMergeUnit(DEFAULT_TEST_HOST, DEFAULT_REPOSITORY, date, DEFAULT_COMMIT_ID,
			DEFAULT_BRANCH_SOURCE, DEFAULT_BRANCH_TARGET, "theFile1", new ArrayList<>(0), new JUnitConfiguration());
	assertEquals(0, unit.compareTo(unit1));
	assertNotEquals(unit.getFileName(), unit1.getFileName());
}
 
源代码24 项目: MergeProcessor   文件: GITMergeUnitTest.java
@DisplayName("Tests compareTo() using 2 GITMergeUnits with different target branch")
@Test
public void testCompareToWithDifferentTargetBranch() {
	final LocalDateTime date = LocalDateTime.now();
	final GITMergeUnit unit = new GITMergeUnit(DEFAULT_TEST_HOST, DEFAULT_REPOSITORY, date, DEFAULT_COMMIT_ID,
			DEFAULT_BRANCH_SOURCE, DEFAULT_BRANCH_TARGET, DEFAULT_FILE_NAME, new ArrayList<>(0),
			new JUnitConfiguration());
	final GITMergeUnit unit1 = new GITMergeUnit(DEFAULT_TEST_HOST, DEFAULT_REPOSITORY, date, "67890",
			DEFAULT_BRANCH_SOURCE, "remotes/origin/V1.1", "theFile1", new ArrayList<>(0), new JUnitConfiguration());
	assertNotEquals(0, unit.equals(unit1));
}
 
源代码25 项目: mongo-kafka   文件: SinkFieldConverterTest.java
@TestFactory
@DisplayName("tests for int16 field conversions")
List<DynamicTest> testInt16FieldConverter() {

  SinkFieldConverter converter = new Int16FieldConverter();

  List<DynamicTest> tests = new ArrayList<>();
  asList(Short.MIN_VALUE, (short) 0, Short.MAX_VALUE)
      .forEach(
          el ->
              tests.add(
                  dynamicTest(
                      "conversion with " + converter.getClass().getSimpleName() + " for " + el,
                      () ->
                          assertEquals(
                              (short) el, ((BsonInt32) converter.toBson(el)).getValue()))));

  tests.add(
      dynamicTest(
          "optional type conversions",
          () -> {
            Schema valueOptionalDefault =
                SchemaBuilder.int16().optional().defaultValue((short) 0);
            assertAll(
                "checks",
                () ->
                    assertThrows(
                        DataException.class, () -> converter.toBson(null, Schema.INT16_SCHEMA)),
                () ->
                    assertEquals(
                        new BsonNull(), converter.toBson(null, Schema.OPTIONAL_INT16_SCHEMA)),
                () ->
                    assertEquals(
                        ((short) valueOptionalDefault.defaultValue()),
                        ((BsonInt32) converter.toBson(null, valueOptionalDefault)).getValue()));
          }));

  return tests;
}
 
源代码26 项目: java-xray-tracer   文件: AWSXRaySpanTests.java
@Test
@DisplayName("tag metadata with nested key")
void tagMetadataNestedKey() {
    final AWSXRaySpan span = mockSpan("test-tag-metadata-nested-key");
    span.setTag("metadata.default.nested.is_test", true);
    span.setTag("metadata.default.nested.counter", 42);
    span.setTag("metadata.default.nested.service", "backend");

    @SuppressWarnings("unchecked")
    final Map<String, Object> targetMap = (Map<String, Object>) span.getEntity().getMetadata().get(AWSXRayMetadataNamespaces.DEFAULT).get("nested");
    assertEquals(true,      targetMap.get("is_test"));
    assertEquals(42,        targetMap.get("counter"));
    assertEquals("backend", targetMap.get("service"));
}
 
源代码27 项目: chart-fx   文件: IirFilterTests.java
@DisplayName("Bessel - Band-Pass")
@ParameterizedTest(name = "{displayName}: filter-order: {0}, algorithm: {1}")
@CsvSource({ "2, 0", "3, 0", "4, 0", "2, 1", "3, 1", "4, 1", "2, 2", "3, 2", "4, 2" })
public void testBesselBandPass(final int filterOrder, final int algorithmVariant) {
    final Bessel iirBandPass = new Bessel();
    switch (algorithmVariant) {
    case 1:
        iirBandPass.bandPass(filterOrder, 1.0, F_BAND_CENTRE, F_BAND_WIDTH, DirectFormAbstract.DIRECT_FORM_I);
        break;
    case 2:
        iirBandPass.bandPass(filterOrder, 1.0, F_BAND_CENTRE, F_BAND_WIDTH, DirectFormAbstract.DIRECT_FORM_II);
        break;
    case 0:
    default:
        iirBandPass.bandPass(filterOrder, 1.0, F_BAND_CENTRE, F_BAND_WIDTH);
        break;
    }

    final DataSet magBandPass = filterAndGetMagnitudeSpectrum(iirBandPass, demoDataSet);
    assertThat("band-pass cut-off (low)", magBandPass.getValue(DIM_X, F_BAND_START), lessThan(EPSILON_DB));
    assertThat("band-pass cut-off (high)", magBandPass.getValue(DIM_X, F_BAND_STOP), lessThan(EPSILON_DB));
    assertThat("band-pass rejection (low)", magBandPass.getValue(DIM_X, 0.1 * F_BAND_START), lessThan(3.0 + EPSILON_DB - 10 * filterOrder));
    assertThat("band-pass rejection (high)", magBandPass.getValue(DIM_X, 10 * F_BAND_STOP), lessThan(3.0 + EPSILON_DB - 10 * filterOrder));
    final double rangePassBand = getRange(magBandPass,
            magBandPass.getIndex(DIM_X, (F_BAND_CENTRE - 0.1 * F_BAND_WIDTH)),
            magBandPass.getIndex(DIM_X, (F_BAND_CENTRE + 0.1 * F_BAND_WIDTH)));
    assertThat("band-pass pass-band ripple", rangePassBand, lessThan(10 * EPSILON_DB));
}
 
源代码28 项目: mongo-kafka   文件: MongoSinkConfigTest.java
@Test
@DisplayName("build config doc (no test)")
// CHECKSTYLE:OFF
void doc() {
  System.out.println(MongoSinkConfig.CONFIG.toRst());
  System.out.println(MarkdownFormatter.toMarkdown(MongoSinkConfig.CONFIG));
  assertTrue(true);
}
 
源代码29 项目: sureness   文件: AuthRoleResourceBindDaoTest.java
@DisplayName("删除数据Bind应成功")
@Test
@Transactional
public void shouldSuccessWhenDeleteBind() {
    AuthRoleResourceBindDO roleResourceBind = AuthRoleResourceBindDO.builder()
            .roleId(123L).resourceId(234L).build();
    roleResourceBind = roleResourceBindDao.save(roleResourceBind);
    roleResourceBindDao.delete(roleResourceBind);
    Assertions.assertThat(roleResourceBindDao.findById(roleResourceBind.getId()).isPresent()).isFalse();
}
 
源代码30 项目: mongo-kafka   文件: RdbmsHandlerTest.java
@Test
@DisplayName("when value doc contains unmapped operation type then DataException")
void testUnmappedCdcOperationType() {
  SinkDocument cdcEvent =
      new SinkDocument(
          BsonDocument.parse("{id: 1234}"),
          BsonDocument.parse("{op: 'c', after: {id: 1234, foo: 'bar'}}"));
  assertThrows(DataException.class, () -> RDBMS_HANDLER_EMPTY_MAPPING.handle(cdcEvent));
}
 
 类所在包
 同包方法