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

项目:EvoMaster    文件:HeuristicsForJumpsTest.java   
@Test
public void test_IF_ACMPNE(){
    // x != y

    Object x = "a";
    Object[] values = new Object[]{new Object(), x, "foo", 5};
    for(Object val: values){

        Truthness eq = getForObjectComparison(x, val, Opcodes.IF_ACMPEQ);
        Truthness ne = getForObjectComparison(x, val, Opcodes.IF_ACMPNE);

        //should be inverted
        assertEquals(eq.getOfTrue(), ne.getOfFalse(), 0.001);
        assertEquals(eq.getOfFalse(), ne.getOfTrue(), 0.001);
    }
}
项目:incubator-plc4x    文件:IsoTPProtocolTest.java   
@Test
@Tag("fast")
public void encodeDisconnectionConfirm() throws Exception {
    ChannelHandlerContext ctx = new MockChannelHandlerContext();
    ByteBuf buf = Unpooled.buffer();
    DisconnectConfirmTpdu tpdu = new DisconnectConfirmTpdu((short)0x1, (short)(0x2), Collections.emptyList(), buf);
    ArrayList<Object> out = new ArrayList<>();

    isoTPProtocol.encode(ctx, tpdu, out);

    assertTrue(out.size() == 1, "Message not decoded");

    ByteBuf userData = ((IsoOnTcpMessage)out.get(0)).getUserData();

    assertTrue(userData.writerIndex() == 6, "Incorrect message length");
    assertTrue(userData.readByte() == (byte)0x5, "Incorrect header length");
    assertTrue(userData.readByte() == TpduCode.DISCONNECT_CONFIRM.getCode(), "Incorrect Tpdu code");
    assertTrue(userData.readShort() == (short)0x1, "Incorrect destination reference code");
    assertTrue(userData.readShort() == (short)0x2, "Incorrect source reference code");
}
项目:trellis    文件:PutHandlerTest.java   
@Test
public void testRdfToNonRDFSource() {
    when(mockResource.getInteractionModel()).thenReturn(LDP.NonRDFSource);
    when(mockLdpRequest.getContentType()).thenReturn(TEXT_TURTLE);
    when(mockLdpRequest.getLink()).thenReturn(fromUri(LDP.NonRDFSource.getIRIString()).rel("type").build());

    final File entity = new File(getClass().getResource("/simpleTriple.ttl").getFile());
    final PutHandler putHandler = new PutHandler(mockLdpRequest, entity, mockResourceService,
            mockIoService, mockBinaryService, null);

    final Response res = putHandler.setResource(mockResource).build();
    assertEquals(NO_CONTENT, res.getStatusInfo());
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.Resource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.RDFSource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.Container)));
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.NonRDFSource)));
}
项目:trellis-rosid    文件:FileResourceServiceTest.java   
@Test
public void testPurge() throws Exception {
    final String myPartition = new File(getClass().getResource("/purgeable").toURI()).getAbsolutePath();
    service = new FileResourceService(myPartition, baseUrl, curator, mockProducer, mockEventService,
            mockIdSupplier, false);
    assertTrue(service.get(identifier).isPresent());
    final List<IRI> binaries = service.purge(identifier).collect(toList());
    assertEquals(1L, binaries.size());
    assertEquals(rdf.createIRI("s3://bucket/some-resource"), binaries.get(0));

    assertFalse(service.get(identifier).isPresent());

    assertTrue(service.get(testResource).isPresent());
    assertEquals(0L, service.purge(testResource).count());
    assertFalse(service.get(testResource).isPresent());
}
项目:qpp-conversion-tool    文件:QualityMeasureIdValidatorTest.java   
@Test
void testInvalidMeasureId() {
    Node measureReferenceResultsNode = new MeasureReferenceBuilder()
            .addMeasureId("InvalidMeasureId")
            .addSubPopulationMeasureDataWithCounts(SubPopulations.IPOP, REQUIRES_DENOM_EXCLUSION_IPOP_GUID, ONE_HUNDRED)
            .addSubPopulationMeasureDataWithCounts(SubPopulations.DENOM, REQUIRES_DENOM_EXCLUSION_DENOM_GUID, ONE_HUNDRED)
            .addSubPopulationMeasureDataWithCounts(SubPopulations.NUMER, REQUIRES_DENOM_EXCLUSION_NUMER_GUID, ONE_HUNDRED)
            .addSubPopulationMeasureDataWithCounts(SubPopulations.DENEX, REQUIRES_DENOM_EXCLUSION_DENEX_GUID, ONE_HUNDRED)
            .build();

    Set<Detail> details = objectUnderTest.validateSingleNode(measureReferenceResultsNode);

    assertWithMessage("There must be one validation errors.")
            .that(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE)
            .containsExactly(ErrorCode.MEASURE_GUID_MISSING);
}
项目:qpp-conversion-tool    文件:AciNumeratorDenominatorEncoderTest.java   
@Test
void testNoChildEncoder() throws EncodeException {
    JsonWrapper jsonWrapper = new JsonWrapper();
    AciNumeratorDenominatorEncoder objectUnderTest = new AciNumeratorDenominatorEncoder(new Context());
    Node unknownNode = new Node();
    aciProportionMeasureNode.addChildNode(unknownNode);

    //execute
    objectUnderTest.internalEncode(jsonWrapper, aciProportionMeasureNode);

    //assert
    assertThat(objectUnderTest.getDetails())
            .hasSize(1);
    assertWithMessage("The validation error must be the inability to find an encoder")
            .that(objectUnderTest.getDetails().get(0).getMessage())
            .isEqualTo("Failed to find an encoder");
}
项目:trellis-rosid-file    文件:FileResourceServiceTest.java   
@Test
public void testResourcePast() {
    final Instant time = parse("2017-02-15T11:00:00Z");
    final Resource res = service.get(identifier, time).get();
    assertEquals(identifier, res.getIdentifier());
    assertEquals(LDP.Container, res.getInteractionModel());
    assertFalse(res.getMembershipResource().isPresent());
    assertFalse(res.getMemberRelation().isPresent());
    assertFalse(res.getMemberOfRelation().isPresent());
    assertFalse(res.getInsertedContentRelation().isPresent());
    assertFalse(res.getBinary().isPresent());
    assertTrue(res.isMemento());
    assertFalse(res.getInbox().isPresent());
    assertEquals(parse("2017-02-15T10:05:00Z"), res.getModified());
    assertEquals(0L, res.getTypes().size());
    assertEquals(0L, res.stream().filter(TestUtils.isContainment.or(TestUtils.isMembership)).count());

    final List<Triple> triples = res.stream().filter(TestUtils.isUserManaged)
        .map(Quad::asTriple).collect(toList());
    assertEquals(0L, triples.size());

    final List<VersionRange> mementos = res.getMementos();
    assertEquals(1L, mementos.size());
    assertEquals(parse("2017-02-15T10:05:00Z"), mementos.get(0).getFrom());
    assertEquals(parse("2017-02-15T11:15:00Z"), mementos.get(0).getUntil());
}
项目:traute    文件:MethodParameterTest.java   
@Test
public void constructor_super() {
    String testSource = String.format(
            "package %s;\n" +
            "\n" +
            "import %s;\n" +
            "\n" +
            "public class %s {\n" +
            "\n" +
            "  public %s(@NotNull Integer intParam) {\n" +
            "    super();\n" +
            "  }\n" +
            "\n" +
            "  public static void main(String[] args) {\n" +
            "    new %s(null);\n" +
            "  }\n" +
            "}", PACKAGE, NotNull.class.getName(), CLASS_NAME, CLASS_NAME, CLASS_NAME);
    expectNpeFromParameterCheck(testSource, "intParam", expectRunResult);
    doTest(testSource);
}
项目:dragoman    文件:DatasetResourceTest.java   
@Test
public void canHandleFailureWhenGettingADatasetSample() {
  Dataset dataset = aPersistedDataset();

  when(datasetDao.get(dataset.getId())).thenReturn(dataset);

  Throwable exception = new RuntimeException("boom!");
  when(reader.read(dataset, "", "", "", 10)).thenReturn(Observable.error(exception));

  String endpoint = "dataset/" + dataset.getId() + "/sample";
  HttpResponse response = read(endpoint);
  assertThat(response.getStatusCode(), is(INTERNAL_SERVER_ERROR.code()));
  assertThat(response.getStatusMessage(), is(INTERNAL_SERVER_ERROR.reasonPhrase()));

  assertThatErrorResponseIsCorrect(
      response.getPayload(), exception.getMessage(), endpoint, INTERNAL_SERVER_ERROR);
}
项目:qpp-conversion-tool    文件:EncoderNegativeConditionsTest.java   
@Test
void testExceptionAddsValidation() throws EncodeException {
    Node numeratorDenominatorNode;
    List<Node> nodes;

    numeratorDenominatorNode = new Node(TemplateId.ACI_AGGREGATE_COUNT);
    numeratorDenominatorNode.putValue("aggregateCount", "600");

    nodes = new ArrayList<>();
    nodes.add(numeratorDenominatorNode);

    QppOutputEncoder encoder = new QppOutputEncoder(new Context());

    encoder.setNodes(nodes);

    FailingWriter failWrite = new FailingWriter();

    encoder.encode(new BufferedWriter(failWrite));

    assertThat(encoder.getDetails()).hasSize(1);
    assertThat(encoder.getDetails().get(0).getMessage())
            .isEqualTo("Fake IOException");
}
项目:trellis-rosid-file    文件:FileUtilsTest.java   
@Test
public void testPartition3() {
    assertEquals(join(separator, "2a", "79", "8c", "70a37cae7da1c312e0d052297e9921aa"),
            FileUtils.partition("trellis:repository/other"));
    assertEquals(join(separator, "2a", "79", "8c", "70a37cae7da1c312e0d052297e9921aa"),
            FileUtils.partition(rdf.createIRI("trellis:repository/other")));
}
项目:trellis-webac    文件:AuthorizationTest.java   
@Test
public void testGraph() {
    final Authorization auth = Authorization.from(subject, graph);

    assertEquals(subject, auth.getIdentifier());

    assertEquals(2, auth.getAgent().size());
    assertTrue(auth.getAgent().contains(rdf.createIRI("info:agent/foo")));
    assertTrue(auth.getAgent().contains(rdf.createIRI("info:agent/bar")));

    assertEquals(1, auth.getAgentClass().size());
    assertTrue(auth.getAgentClass().contains(rdf.createIRI("info:agent/SomeClass")));

    assertEquals(4, auth.getAgentGroup().size());
    assertTrue(auth.getAgentGroup().contains(rdf.createIRI("info:group/group1")));

    assertEquals(1, auth.getMode().size());
    assertTrue(auth.getMode().contains(ACL.Read));

    assertEquals(3, auth.getAccessTo().size());
    assertTrue(auth.getAccessTo().contains(rdf.createIRI("trellis:repository/resource2")));
    assertTrue(auth.getAccessTo().contains(rdf.createIRI("trellis:repository/resource3")));
    assertTrue(auth.getAccessTo().contains(rdf.createIRI("trellis:repository/resource4")));

    assertEquals(1, auth.getDefault().size());
    assertTrue(auth.getDefault().contains(rdf.createIRI("trellis:repository/container")));
}
项目:incubator-plc4x    文件:APIMessageTests.java   
@Test
@Tag("fast")
void plcWriteRequestItem() {
    MockAddress address = new MockAddress("mock:/DATA");
    WriteRequestItem writeRequestItem = new WriteRequestItem(Byte.class, address, (byte) 0x45);

    assertTrue(writeRequestItem.getAddress().equals(address), "Unexpected address");
    assertTrue(writeRequestItem.getDatatype() == Byte.class, "Unexpected data type");
    assertTrue((Byte) writeRequestItem.getValues()[0] == 0x45, "Unexpected value");
}
项目:trellis    文件:LdpForbiddenResourceTest.java   
@Test
public void testPut1() {
    final Response res = target("repo1/resource").queryParam("ext", "acl").request()
        .put(entity("<> <http://purl.org/dc/terms/title> \"A title\" . ", APPLICATION_N_TRIPLES_TYPE));

    assertEquals(FORBIDDEN, res.getStatusInfo());
}
项目:fuse-nio-adapter    文件:FileAttributesUtilTest.java   
@Test
public void testBasicFileAttributesToFileStat() {
    Instant instant = Instant.ofEpochSecond(424242l, 42);
    FileTime ftime = FileTime.from(instant);
    BasicFileAttributes attr = Mockito.mock(BasicFileAttributes.class);
    Mockito.when(attr.isDirectory()).thenReturn(true);
    Mockito.when(attr.lastModifiedTime()).thenReturn(ftime);
    Mockito.when(attr.creationTime()).thenReturn(ftime);
    Mockito.when(attr.lastAccessTime()).thenReturn(ftime);
    Mockito.when(attr.size()).thenReturn(42l);

    FileAttributesUtil util = new FileAttributesUtil();
    FileStat stat = util.basicFileAttributesToFileStat(attr);

    Assertions.assertTrue((FileStat.S_IFDIR & stat.st_mode.intValue()) == FileStat.S_IFDIR);
    Assertions.assertEquals(424242l, stat.st_mtim.tv_sec.get());
    Assertions.assertEquals(42, stat.st_mtim.tv_nsec.intValue());
    Assertions.assertEquals(424242l, stat.st_ctim.tv_sec.get());
    Assertions.assertEquals(42, stat.st_ctim.tv_nsec.intValue());
    Assumptions.assumingThat(Platform.IS_MAC || Platform.IS_WINDOWS, () -> {
        Assertions.assertEquals(424242l, stat.st_birthtime.tv_sec.get());
        Assertions.assertEquals(42, stat.st_birthtime.tv_nsec.intValue());
    });
    Assertions.assertEquals(424242l, stat.st_atim.tv_sec.get());
    Assertions.assertEquals(42, stat.st_atim.tv_nsec.intValue());
    Assertions.assertEquals(42l, stat.st_size.longValue());
}
项目:hygene    文件:MenuControllerTest.java   
@Test
void testGfaFileOpenerCancel() throws Exception {
    final GraphStore graphStore = mock(GraphStore.class);
    final FileChooser fileChooser = mock(FileChooser.class);

    menuController.setGfaFileChooser(fileChooser);
    menuController.setGraphStore(graphStore);
    menuController.openGfaFileAction(mock(ActionEvent.class));

    verify(graphStore, never()).loadGfaFile(any(File.class), any(ProgressUpdater.class));
}
项目:trellis-rosid    文件:JwtAuthenticatorTest.java   
@Test
public void testAuthenticateTokenIssSub() throws AuthenticationException {
    final String key = "secret";
    final String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhY29idXJuIiwibmFtZSI6IkFhcm9" +
        "uIENvYnVybiIsImlzcyI6Imh0dHA6Ly9leGFtcGxlLm9yZy8ifQ.DPb_i9vfI5um2X_g_df2y1uFktThGdDBo-Q7AMqjaWc";

    final Authenticator<String, Principal> authenticator = new JwtAuthenticator(key, false);

    final Optional<Principal> result = authenticator.authenticate(token);
    assertTrue(result.isPresent());
    result.ifPresent(p -> {
        assertEquals("http://example.org/acoburn", p.getName());
    });
}
项目:incubator-plc4x    文件:S7AddressTests.java   
@Test
@Tag("fast")
void testS7Address() {
    MemoryArea memoryArea = MemoryArea.DATA_BLOCKS;
    S7Address s7Address = new S7Address(memoryArea, (short) 0x100);

    assertTrue(s7Address.getMemoryArea() == MemoryArea.DATA_BLOCKS, "Wrong memory area");
    assertTrue( s7Address.getByteOffset() == 0x100, "Memory area byte offset incorrect");
}
项目:base62    文件:Base62Test.java   
@Test
@DisplayName("should behave correctly on naive test set")
public void naiveTestSet() {
    for (Map.Entry<String, String> testSetEntry : Environment.getNaiveTestSet().entrySet()) {
        assertEquals(encode(testSetEntry.getKey()), testSetEntry.getValue());
    }
}
项目:qpp-conversion-tool    文件:ExceptionHandlerControllerV1Test.java   
@Test
void testTransformExceptionBody() {
    TransformException exception =
            new TransformException("test transform exception", new NullPointerException(), report);

    ResponseEntity<AllErrors> responseEntity = objectUnderTest.handleTransformException(exception);
    assertThat(responseEntity.getBody()).isEqualTo(allErrors);
}
项目:paper    文件:BooleanRuleTest.java   
@Test
public void isValid() throws Exception {
    assertTrue(this.subject.isValid("Yes"));
    assertTrue(this.subject.isValid("No"));
    assertFalse(this.subject.isValid("Y"));
    assertFalse(this.subject.isValid("N"));
}
项目:trellis    文件:WebACServiceTest.java   
@Test
public void testCanWrite1() {
    when(mockSession.getAgent()).thenReturn(acoburnIRI);
    assertFalse(testService.getAccessModes(nonexistentIRI, mockSession).contains(ACL.Write));
    assertFalse(testService.getAccessModes(resourceIRI, mockSession).contains(ACL.Write));
    assertFalse(testService.getAccessModes(childIRI, mockSession).contains(ACL.Write));
    assertFalse(testService.getAccessModes(parentIRI, mockSession).contains(ACL.Write));
    assertFalse(testService.getAccessModes(rootIRI, mockSession).contains(ACL.Write));
}
项目:xml-namespace-context    文件:GetNamespaceTest.java   
@Test
void givenDefaultByMapGetNamespaceURIShouldReturnDefaultNSForEmptyPrefix() {

    Map<String, String> map = new HashMap<>();
    map.put(DEFAULT_NS_PREFIX, EXAMPLE_NS);

    context= new HashMapNamespaceContext(map);
    assertEquals(EXAMPLE_NS,context.getNamespaceURI(DEFAULT_NS_PREFIX));
}
项目:trellis    文件:PatchHandlerTest.java   
@Test
public void testConflict() {
    when(mockRequest.evaluatePreconditions(any(Date.class), any(EntityTag.class)))
        .thenReturn(status(CONFLICT));
    when(mockLdpRequest.getPath()).thenReturn("resource");

    final PatchHandler patchHandler = new PatchHandler(mockLdpRequest, insert,
            mockResourceService, mockIoService, null);

    assertThrows(WebApplicationException.class, () -> patchHandler.updateResource(mockResource));
}
项目:postmark-java    文件:BounceTest.java   
@Test
void bounceList() throws PostmarkException, IOException {
    Bounces bounces = client.getBounces(Parameters.init().build("count", 5).build("offset", 0));

    assertTrue(bounces.getTotalCount() > 0);
    assertNotNull(bounces.getBounces().get(0).getBouncedAt());
}
项目:hygene    文件:GraphIteratorTest.java   
/**
 * Tests that the depth component of the BiConsumer is correct for the given graph.
 */
@Test
void testVisitAllWithinRangeDepthRandom() {
    createGraph(9);
    addEdges(new int[][] {
            {0, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 3}, {2, 5}, {3, 5},
            {4, 5}, {4, 6}, {4, 7}, {5, 6}, {5, 8}, {6, 7}, {6, 8}});

    final int[] depths = new int[9];
    new GraphIterator(getGraph()).visitAllWithinRange(SequenceDirection.RIGHT, 99,
            (depth, node) -> depths[node] = depth);

    assertThat(depths).containsExactly(0, 1, 2, 2, 2, 3, 3, 3, 4);
}
项目:ocraft-s2client    文件:ResponseLeaveGameTest.java   
@Test
void throwsExceptionWhenSc2ApiResponseDoesNotHaveLeaveGame() {
    assertThatExceptionOfType(IllegalArgumentException.class)
            .isThrownBy(() -> ResponseLeaveGame.from(nothing()))
            .withMessage("provided argument doesn't have leave game response");

    assertThatExceptionOfType(IllegalArgumentException.class)
            .isThrownBy(() -> ResponseLeaveGame.from(aSc2ApiResponse().build()))
            .withMessage("provided argument doesn't have leave game response");
}
项目:ocraft-s2client    文件:ActionSpatialTest.java   
@Test
void serializesToSc2ApiActionSpatialWithCameraMove() {
    Spatial.ActionSpatial sc2ApiActionSpatial = ActionSpatial.of(
            cameraMove().to(PointI.of(1, 1)).build()
    ).toSc2Api();

    assertThat(sc2ApiActionSpatial.hasUnitCommand()).as("sc2api action spatial: case of action is unit command")
            .isFalse();
    assertThat(sc2ApiActionSpatial.hasCameraMove()).as("sc2api action spatial: case of action is camera move")
            .isTrue();
    assertThat(sc2ApiActionSpatial.hasUnitSelectionPoint())
            .as("sc2api action spatial: case of action is unit selection point").isFalse();
    assertThat(sc2ApiActionSpatial.hasUnitSelectionRect())
            .as("sc2api action spatial: case of action is unit selection rect").isFalse();
}
项目:incubator-plc4x    文件:S7TypeTests.java   
@Test
@Tag("fast")
void unknownMemoryAccess() {
    MemoryArea memoryArea = MemoryArea.DATA_BLOCKS;

    assertTrue(MemoryArea.valueOf((byte)0xFF) == null, "Unexpected value mapped");
 }
项目:trellis    文件:AbstractLdpResourceTest.java   
@Test
public void testPutConstraint() {
    final Response res = target(RESOURCE_PATH).request()
        .put(entity("<> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> \"Some literal\" .",
                TEXT_TURTLE_TYPE));

    assertEquals(CONFLICT, res.getStatusInfo());
    assertTrue(res.getLinks().stream()
            .anyMatch(hasLink(Trellis.InvalidRange, LDP.constrainedBy.getIRIString())));
}
项目:trellis-api    文件:ResourceServiceTest.java   
@Test
public void testSkolemization() {
    final BlankNode bnode = rdf.createBlankNode("testing");
    final IRI iri = rdf.createIRI("trellis:bnode/testing");
    final IRI resource = rdf.createIRI("trellis:repository/resource");

    assertTrue(mockResourceService.skolemize(bnode) instanceof IRI);
    assertTrue(((IRI) mockResourceService.skolemize(bnode)).getIRIString().startsWith("trellis:bnode/"));
    assertTrue(mockResourceService.unskolemize(iri) instanceof BlankNode);
    assertEquals(mockResourceService.unskolemize(iri), mockResourceService.unskolemize(iri));

    assertFalse(mockResourceService.unskolemize(rdf.createLiteral("Test")) instanceof BlankNode);
    assertFalse(mockResourceService.unskolemize(resource) instanceof BlankNode);
    assertFalse(mockResourceService.skolemize(rdf.createLiteral("Test2")) instanceof IRI);
}
项目:shuffleboard    文件:PreferencesUtilsTest.java   
@Test
public void testSaveDouble() {
  // given
  String name = "double";
  double value = Double.MAX_VALUE;
  DoubleProperty property = new SimpleDoubleProperty(null, name, value);

  // when
  PreferencesUtils.save(property, preferences);

  // then
  double saved = preferences.getDouble(name, -1);
  assertEquals(value, saved);
}
项目:hygene    文件:ThrottledDefaultExecutorTest.java   
@Test
void testRunDefaultTwice() {
    final int[] number = {0};

    final ThrottledDefaultExecutor executor = new ThrottledDefaultExecutor(0, () -> number[0]++);

    executor.run();
    executor.run();
    executor.block();

    assertThat(number[0]).isEqualTo(1);
}
项目:qpp-conversion-tool    文件:ValidationServiceImplTest.java   
@Test
void testValidationPass() {
    String validationUrl = "https://qpp.net/validate";

    when(environment.getProperty(eq(Constants.VALIDATION_URL_ENV_VARIABLE))).thenReturn(validationUrl);
    ResponseEntity<String> spiedResponseEntity = spy(new ResponseEntity<>(HttpStatus.OK));
    when(restTemplate.postForEntity(eq(validationUrl), any(HttpEntity.class), eq(String.class))).thenReturn(spiedResponseEntity);

    objectUnderTest.validateQpp(converter.getReport());

    verify(spiedResponseEntity, never()).getBody();
}
项目:EvoMaster    文件:HeuristicsForJumpsTest.java   
@Test
public void test_IFNONNULL(){
    // x != null

    Object[] values = new Object[]{null, new Object(), "foo", 5};
    for(Object val: values){

        Truthness nn = getForNullComparison(val, Opcodes.IFNONNULL);
        Truthness nu = getForNullComparison(val, Opcodes.IFNULL);

        //should be inverted
        assertEquals(nn.getOfFalse(), nu.getOfTrue(), 0.001);
        assertEquals(nn.getOfTrue(), nu.getOfFalse(), 0.001);
    }
}
项目:traute    文件:MethodReturnTest.java   
@Test
public void else_withoutBracesSameLine() {
    doMethodReturnTest(
            "" +
            "if (false) {\n" +
            "  return 1;\n" +
            "} else return count();"
    );
}
项目:incubator-plc4x    文件:APIMessageTests.java   
@Test
@Tag("fast")
void plcReadRequestAddress() {
    MockAddress address = new MockAddress("mock:/DATA");
    PlcReadRequest plcReadRequest = new PlcReadRequest(Byte.class, address);
    assertTrue(plcReadRequest.getReadRequestItems().size() == 1, "Expected one request item");
    assertTrue(plcReadRequest.getNumItems() == 1, "Expected one request item");
}
项目:hygene    文件:NodeMetadataCacheTest.java   
@Test
void testMergeConstructorMultipleElementsWithDuplicates() {
    final List<NodeMetadata> metadataList = new ArrayList<>();
    final NodeMetadata metadataA = new NodeMetadata("nameA", "sequenceA", Arrays.asList("genA", "genB"));
    final NodeMetadata metadataB = new NodeMetadata("nameB", "sequenceB", Arrays.asList("genB", "genC"));
    metadataList.add(metadataA);
    metadataList.add(metadataB);

    final NodeMetadata mergedMetadata = new NodeMetadata(metadataList);

    assertThat(mergedMetadata.getName()).isEqualTo("[nameA, nameB]");
    assertThat(mergedMetadata.getSequence()).isEqualTo("[sequenceA, sequenceB]");
    assertThat(mergedMetadata.getGenomes()).containsExactly("genA", "genB", "genC");
}
项目:convert-junit4-to-junit5    文件:JunitConversionLogicTest.java   
@Test
void specificStaticFail() {
    String originalImport = "import org.junit.Assert;";
    String originalMethod = "Assert.fail(a);";
    String expectedImport = "import org.junit.jupiter.api.Assertions;";
    String expectedMethod = "Assertions.fail(a);";
    assertAfterWrappingInMethod(originalImport, originalMethod, expectedImport, expectedMethod);
}
项目:Nukkit-Java9    文件:VarIntTest.java   
@DisplayName("Reading")
@Test
void testRead() {
    assertAll(
            () -> assertEquals(2412, VarInt.readUnsignedVarInt(wrapBinaryStream("EC123EC456"))),
            () -> assertEquals(583868, VarInt.readUnsignedVarInt(wrapBinaryStream("BCD123EFA0"))),
            () -> assertEquals(1206, VarInt.readVarInt(wrapBinaryStream("EC123EC456"))),
            () -> assertEquals(291934, VarInt.readVarInt(wrapBinaryStream("BCD123EFA0"))),
            () -> assertEquals(6015, VarInt.readUnsignedVarLong(wrapBinaryStream("FF2EC456EC789EC012EC"))),
            () -> assertEquals(3694, VarInt.readUnsignedVarLong(wrapBinaryStream("EE1CD34BCD56BCD78BCD"))),
            () -> assertEquals(-3008, VarInt.readVarLong(wrapBinaryStream("FF2EC456EC789EC012EC"))),
            () -> assertEquals(1847, VarInt.readVarLong(wrapBinaryStream("EE1CD34BCD56BCD78BCD")))
    );
}