Java Code Examples for org.testng.Assert#assertFalse()

The following examples show how to use org.testng.Assert#assertFalse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestZkBaseDataAccessor.java    From helix with Apache License 2.0 6 votes vote down vote up
@Test
public void testSyncExist() {
  String className = TestHelper.getTestClassName();
  String methodName = TestHelper.getTestMethodName();
  String testName = className + "_" + methodName;

  System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis()));

  String path = String.format("/%s/%s", _rootPath, "msg_0");
  ZNRecord record = new ZNRecord("msg_0");
  ZkBaseDataAccessor<ZNRecord> accessor = new ZkBaseDataAccessor<ZNRecord>(_gZkClient);

  boolean success = accessor.exists(path, 0);
  Assert.assertFalse(success);

  success = accessor.create(path, record, AccessOption.EPHEMERAL);
  Assert.assertTrue(success);

  success = accessor.exists(path, 0);
  Assert.assertTrue(success);

  System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis()));

}
 
Example 2
Source File: PosParserTest.java    From picard with MIT License 6 votes vote down vote up
@Test(dataProvider = "singleTileData")
public void singleTileDataTest(final int tile, final Integer startingTile, final File file) {
    final IlluminaFileMap fm = new IlluminaFileMap();
    fm.put(tile, file);

    final PosParser parser = (startingTile == null) ? new PosParser(fm, IlluminaFileUtil.SupportedIlluminaFormat.Pos) :
                                                      new PosParser(fm, startingTile, IlluminaFileUtil.SupportedIlluminaFormat.Pos);
    final Iterator<TestResult> expected = TEST_DATA.get(file.getName()).iterator();

    int index = 0;
    while(expected.hasNext()) {
        Assert.assertTrue(parser.hasNext());
        compareResults(expected.next(), parser.next(), index);
        ++index;
    }

    Assert.assertFalse(parser.hasNext());
    parser.close();
}
 
Example 3
Source File: LLRealtimeSegmentDataManagerTest.java    From incubator-pinot with Apache License 2.0 6 votes vote down vote up
@Test
public void testDiscarded()
    throws Exception {
  FakeLLRealtimeSegmentDataManager segmentDataManager = createFakeSegmentManager();
  LLRealtimeSegmentDataManager.PartitionConsumer consumer = segmentDataManager.createPartitionConsumer();
  final LongMsgOffset endOffset = new LongMsgOffset(_startOffsetValue + 500);
  segmentDataManager._consumeOffsets.add(endOffset);
  final SegmentCompletionProtocol.Response discardResponse = new SegmentCompletionProtocol.Response(
      new SegmentCompletionProtocol.Response.Params().withStreamPartitionMsgOffset(endOffset.toString())
          .withStatus(SegmentCompletionProtocol.ControllerResponseStatus.DISCARD));
  segmentDataManager._responses.add(discardResponse);

  consumer.run();

  Assert.assertTrue(segmentDataManager._responses.isEmpty());
  Assert.assertTrue(segmentDataManager._consumeOffsets.isEmpty());
  Assert.assertFalse(segmentDataManager._buildSegmentCalled);
  Assert.assertFalse(segmentDataManager._buildAndReplaceCalled);
  Assert.assertFalse(segmentDataManager._downloadAndReplaceCalled);
  Assert.assertFalse(segmentDataManager._commitSegmentCalled);
  Assert
      .assertEquals(segmentDataManager._state.get(segmentDataManager), LLRealtimeSegmentDataManager.State.DISCARDED);
  segmentDataManager.destroy();
}
 
Example 4
Source File: ConnectionTimeoutTest.java    From pulsar with Apache License 2.0 6 votes vote down vote up
@Test
public void testLowTimeout() throws Exception {
    long startNanos = System.nanoTime();

    try (PulsarClient clientLow = PulsarClient.builder().serviceUrl(blackholeBroker)
            .connectionTimeout(1, TimeUnit.MILLISECONDS)
            .operationTimeout(1000, TimeUnit.MILLISECONDS).build();
         PulsarClient clientDefault = PulsarClient.builder().serviceUrl(blackholeBroker)
             .operationTimeout(1000, TimeUnit.MILLISECONDS).build()) {
        CompletableFuture<?> lowFuture = clientLow.newProducer().topic("foo").createAsync();
        CompletableFuture<?> defaultFuture = clientDefault.newProducer().topic("foo").createAsync();

        try {
            lowFuture.get();
            Assert.fail("Shouldn't be able to connect to anything");
        } catch (Exception e) {
            Assert.assertFalse(defaultFuture.isDone());
            Assert.assertEquals(e.getCause().getCause().getCause().getClass(), ConnectTimeoutException.class);
        }
    }
}
 
Example 5
Source File: ItemsSketchTest.java    From incubator-datasketches-java with Apache License 2.0 6 votes vote down vote up
@Test
public void mergeExact() {
  ItemsSketch<String> sketch1 = new ItemsSketch<>(1 << LG_MIN_MAP_SIZE);
  sketch1.update("a");
  sketch1.update("b");
  sketch1.update("c");
  sketch1.update("d");

  ItemsSketch<String> sketch2 = new ItemsSketch<>(1 << LG_MIN_MAP_SIZE);
  sketch2.update("b");
  sketch2.update("c");
  sketch2.update("b");

  sketch1.merge(sketch2);
  Assert.assertFalse(sketch1.isEmpty());
  Assert.assertEquals(sketch1.getNumActiveItems(), 4);
  Assert.assertEquals(sketch1.getStreamLength(), 7);
  Assert.assertEquals(sketch1.getEstimate("a"), 1);
  Assert.assertEquals(sketch1.getEstimate("b"), 3);
  Assert.assertEquals(sketch1.getEstimate("c"), 2);
  Assert.assertEquals(sketch1.getEstimate("d"), 1);
}
 
Example 6
Source File: CellBarcodeFilteringIteratorTest.java    From Drop-seq with MIT License 6 votes vote down vote up
@Test
public void filterOut2() {
	Iterator<SAMRecord> underlyingIterator = Collections.emptyIterator();
	Collection<String> cellBarcodesToKeep = null;
	String cellBCTag ="XC";

	CellBarcodeFilteringIterator f = new CellBarcodeFilteringIterator(underlyingIterator, cellBCTag, cellBarcodesToKeep);
	SAMRecordSetBuilder b = new SAMRecordSetBuilder();
	// second argument is the contig index which is 0 based.  So contig index=0 -> chr1.  index=2 -> chr3, etc.
	b.addFrag("1", 0, 1, false);
	SAMRecord r1 = b.getRecords().iterator().next();

	r1.setAttribute(cellBCTag, "CELL1");
	Assert.assertFalse(f.filterOut(r1));

	r1.setAttribute(cellBCTag, "CELL2");
	Assert.assertFalse(f.filterOut(r1));

}
 
Example 7
Source File: FilterTest.java    From incubator-datasketches-java with Apache License 2.0 6 votes vote down vote up
@Test
public void filledSketchShouldBehaveTheSame() {
    UpdatableSketch<Double, DoubleSummary> sketch =
        new UpdatableSketchBuilder<>(new DoubleSummaryFactory(mode)).build();

    fillSketch(sketch, numberOfElements, 0.0);

    Filter<DoubleSummary> filter = new Filter<>(o -> true);

    Sketch<DoubleSummary> filteredSketch = filter.filter(sketch);

    Assert.assertEquals(filteredSketch.getEstimate(), sketch.getEstimate());
    Assert.assertEquals(filteredSketch.getThetaLong(), sketch.getThetaLong());
    Assert.assertFalse(filteredSketch.isEmpty());
    Assert.assertEquals(filteredSketch.getLowerBound(1), sketch.getLowerBound(1));
    Assert.assertEquals(filteredSketch.getUpperBound(1), sketch.getUpperBound(1));
}
 
Example 8
Source File: MatchRuleUtilsTest.java    From flashback with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void testUriWhitelistNotMatchDifferentOrder()
    throws Exception {
  RecordedHttpRequest recordedHttpRequest1 =
      new RecordedHttpRequest(null, new URI("http://www.google.com/?b=b&c=c&a=a"), null, null);
  RecordedHttpRequest recordedHttpRequest2 =
      new RecordedHttpRequest(null, new URI("http://www.google.com/?b=z&a=a&c=c"), null, null);
  HashSet<String> whitelist = new HashSet<>();
  whitelist.add("a");
  whitelist.add("c");
  MatchRule matchRule = MatchRuleUtils.matchUriWithQueryWhitelist(whitelist);
  Assert.assertFalse(matchRule.test(recordedHttpRequest1, recordedHttpRequest2));
  Assert.assertTrue(matchRule.getMatchFailureDescriptionForRequests(recordedHttpRequest1, recordedHttpRequest2).contains("URI Mismatch (with Query Whitelist)"));
}
 
Example 9
Source File: NDArrayElementComparisonOpTest.java    From djl with Apache License 2.0 5 votes vote down vote up
@Test
public void testContentEquals() {
    try (NDManager manager = NDManager.newBaseManager()) {
        NDArray array1 = manager.create(new float[] {1f, 2f});
        NDArray array2 = manager.create(new float[] {1f, 2f});
        Assert.assertTrue(array1.contentEquals(array2));
        array1 = manager.ones(new Shape(2, 3));
        array2 = manager.ones(new Shape(1, 3));
        Assert.assertFalse(array1.contentEquals(array2));

        // test scalar
        array1 = manager.create(5f);
        array2 = manager.create(5f);
        Assert.assertTrue(array1.contentEquals(array2));
        array1 = manager.create(3);
        array2 = manager.create(4);
        Assert.assertFalse(array1.contentEquals(array2));

        // different data type
        array1 = manager.create(4f);
        array2 = manager.create(4);
        Assert.assertFalse(array1.contentEquals(array2));

        // test zero dim vs zero dim
        array1 = manager.create(new Shape(4, 0));
        array2 = manager.create(new Shape(4, 0));

        Assert.assertTrue(array1.contentEquals(array2));
        array1 = manager.create(new Shape(0, 0, 2));
        array2 = manager.create(new Shape(2, 0, 0));
        Assert.assertFalse(array1.contentEquals(array2));
    }
}
 
Example 10
Source File: TabularResultTests.java    From quandl4j with Apache License 2.0 5 votes vote down vote up
@Test
public void testIterator() {
  HeaderDefinition headerDefinition1 = HeaderDefinition.of("A", "B", "C", "D");
  HeaderDefinition headerDefinition2 = HeaderDefinition.of("A", "B", "C", "D");
  HeaderDefinition headerDefinition3 = HeaderDefinition.of("B", "A", "C", "D");
  Row row1 = Row.of(headerDefinition1, new String[] {"Jim", "Miranda", "1.2", "2009-09-13" });
  Row row2 = Row.of(headerDefinition1, new String[] {"Jim", "Miranda", "1.2", "2009-09-13" });
  Row row3 = Row.of(headerDefinition2, new String[] {"Jim", "Miranda", "Elaine", "Kostas" });
  Row row4 = Row.of(headerDefinition3, new String[] {"Jim", "Miranda", "Elaine", "Kostas" });
  TabularResult tr1 = TabularResult.of(headerDefinition1, Arrays.asList(row1, row3));
  TabularResult tr2 = TabularResult.of(headerDefinition2, Arrays.asList(row2, row4));
  TabularResult tr3 = TabularResult.of(headerDefinition2, Arrays.asList(row2, row1));
  Iterator<Row> iter1 = tr1.iterator();
  Iterator<Row> iter2 = tr2.iterator();
  Iterator<Row> iter3 = tr3.iterator();
  Assert.assertTrue(iter1.hasNext()); 
  Assert.assertTrue(iter2.hasNext());
  Assert.assertTrue(iter3.hasNext());
  Row next1 = iter1.next();
  Row next2 = iter2.next();
  Row next3 = iter3.next();
  Assert.assertEquals(next2, next1);
  Assert.assertEquals(next2, next3);
  Assert.assertEquals(next1, next3);
  Assert.assertTrue(iter1.hasNext()); 
  Assert.assertTrue(iter2.hasNext());
  Assert.assertTrue(iter3.hasNext());
  Row nextnext1 = iter1.next();
  Row nextnext2 = iter2.next();
  Row nextnext3 = iter3.next();
  Assert.assertNotEquals(nextnext2, nextnext1);
  Assert.assertNotEquals(nextnext2, nextnext3);
  Assert.assertFalse(iter1.hasNext()); 
  Assert.assertFalse(iter2.hasNext());
  Assert.assertFalse(iter3.hasNext());
}
 
Example 11
Source File: WalletTestWitness001.java    From gsc-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test(enabled = true)
public void testVoteWitness() {
  String voteStr = Base58.encode58Check(witnessAddress);
  HashMap<String, String> smallVoteMap = new HashMap<String, String>();
  smallVoteMap.put(voteStr, "1");
  HashMap<String, String> wrongVoteMap = new HashMap<String, String>();
  wrongVoteMap.put(voteStr, "-1");
  HashMap<String, String> zeroVoteMap = new HashMap<String, String>();
  zeroVoteMap.put(voteStr, "0");

  HashMap<String, String> veryLargeMap = new HashMap<String, String>();
  veryLargeMap.put(voteStr, "1000000000");
  HashMap<String, String> wrongDropMap = new HashMap<String, String>();
  wrongDropMap.put(voteStr, "10000000000000000");

  //Freeze balance to get vote ability.
  Assert.assertTrue(PublicMethed.freezeBalance(fromAddress, 1200000L, 5,
      testKey002, blockingStubFull));
  PublicMethed.waitProduceNextBlock(blockingStubFull);
  //Vote failed when the vote is large than the freeze balance.
  Assert.assertFalse(voteWitness(veryLargeMap, fromAddress, testKey002));
  //Vote failed due to 0 vote.
  Assert.assertFalse(voteWitness(zeroVoteMap, fromAddress, testKey002));
  //Vote failed duo to -1 vote.
  Assert.assertFalse(voteWitness(wrongVoteMap, fromAddress, testKey002));
  //Vote is so large, vote failed.
  Assert.assertFalse(voteWitness(wrongDropMap, fromAddress, testKey002));

  //Vote success
  Assert.assertTrue(voteWitness(smallVoteMap, fromAddress, testKey002));


}
 
Example 12
Source File: NDArrayOtherOpTest.java    From djl with Apache License 2.0 5 votes vote down vote up
@Test
public void testIsNaN() {
    try (NDManager manager = NDManager.newBaseManager()) {
        NDArray array = manager.create(new float[] {Float.NaN, 0f});
        NDArray expected = manager.create(new boolean[] {true, false});
        Assert.assertEquals(array.isNaN(), expected);
        array = manager.create(new float[] {1f, 2f});
        Assert.assertFalse(array.isNaN().all().getBoolean());

        // test multi-dim
        array =
                manager.create(
                        new float[] {Float.NaN, Float.NaN, Float.NaN, 0f}, new Shape(2, 2));
        expected = manager.create(new boolean[] {true, true, true, false}, new Shape(2, 2));
        Assert.assertEquals(array.isNaN(), expected);

        // test scalar
        array = manager.create(Float.NaN);
        expected = manager.create(true);
        Assert.assertEquals(array.isNaN(), expected);

        // test zero-dim
        array = manager.create(new Shape(0));
        expected = manager.create(new Shape(0), DataType.BOOLEAN);
        Assert.assertEquals(array.isNaN(), expected);
    }
}
 
Example 13
Source File: ArrayOfDoublesAnotBTest.java    From incubator-datasketches-java with Apache License 2.0 5 votes vote down vote up
@Test
public void estimationMode() {
  int key = 0;
  ArrayOfDoublesUpdatableSketch sketchA = new ArrayOfDoublesUpdatableSketchBuilder().build();
  for (int i = 0; i < 8192; i++) {
    sketchA.update(key++, new double[] {1});
  }

  key -= 4096; // overlap half of the entries
  ArrayOfDoublesUpdatableSketch sketchB = new ArrayOfDoublesUpdatableSketchBuilder().build();
  for (int i = 0; i < 8192; i++) {
    sketchB.update(key++, new double[] {1});
  }

  ArrayOfDoublesAnotB aNotB = new ArrayOfDoublesSetOperationBuilder().buildAnotB();
  aNotB.update(sketchA, sketchB);
  ArrayOfDoublesCompactSketch result = aNotB.getResult();
  Assert.assertFalse(result.isEmpty());
  Assert.assertEquals(result.getEstimate(), 4096.0, 4096 * 0.03); // crude estimate of RSE(95%) = 2 / sqrt(result.getRetainedEntries())
  Assert.assertTrue(result.getLowerBound(1) <= result.getEstimate());
  Assert.assertTrue(result.getUpperBound(1) > result.getEstimate());
  ArrayOfDoublesSketchIterator it = result.iterator();
  while (it.next()) {
    Assert.assertEquals(it.getValues(), new double[] {1});
  }

  // same operation, but compact sketches and off-heap result
  aNotB.update(sketchA.compact(), sketchB.compact());
  result = aNotB.getResult(WritableMemory.wrap(new byte[1000000]));
  Assert.assertFalse(result.isEmpty());
  Assert.assertEquals(result.getEstimate(), 4096.0, 4096 * 0.03); // crude estimate of RSE(95%) = 2 / sqrt(result.getRetainedEntries())
  Assert.assertTrue(result.getLowerBound(1) <= result.getEstimate());
  Assert.assertTrue(result.getUpperBound(1) > result.getEstimate());
  it = result.iterator();
  while (it.next()) {
    Assert.assertEquals(it.getValues(), new double[] {1});
  }
}
 
Example 14
Source File: AssertorTest.java    From validatar with Apache License 2.0 5 votes vote down vote up
@Test
public void testFilteringJoinAssertion() {
    Result a = new Result("A");
    addColumnToResult(a, "country", TypeSystem.Type.STRING, "us", "au", "cn", "in", "uk", "fr", "es", "de", "ru");
    addColumnToResult(a, "region", TypeSystem.Type.STRING, "na", "au", "as", "as", "eu", "eu", "ue", "eu", "eu");
    addColumnToResult(a, "id", TypeSystem.Type.LONG, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L);
    addColumnToResult(a, "total", TypeSystem.Type.LONG, 19L, 5L, 9L, 4L, 1200L, 90L, 120L, 9000L, 10000L);

    com.yahoo.validatar.common.Test test = new com.yahoo.validatar.common.Test();
    test.asserts = new ArrayList<>();
    test.asserts.add("A.total >= 90 where A.region == 'eu'");

    Assertor.assertAll(wrap(a), wrap(test));
    Assert.assertFalse(test.failed());
}
 
Example 15
Source File: ProcessControllerUnitTest.java    From gatk with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test(dataProvider = "scriptCommands")
public void testScript(ScriptCommand script) throws IOException {
    File scriptFile = null;
    File outputFile = null;
    try {
        scriptFile = writeScript(script.content);
        outputFile = GATKBaseTest.createTempFile("temp", "");

        ProcessSettings job = new ProcessSettings(new String[]{"sh", scriptFile.getAbsolutePath()});
        if (script.output != null) {
            job.getStdoutSettings().setOutputFile(outputFile);
            job.getStdoutSettings().setBufferSize(script.output.getBytes().length);
        }

        ProcessOutput result = new ProcessController().exec(job);
        int exitValue = result.getExitValue();

        Assert.assertEquals(exitValue == 0, script.succeed,
                String.format("Script returned %d: %s", exitValue, script));

        if (script.output != null) {

            String fileString = FileUtils.readFileToString(outputFile, StandardCharsets.UTF_8);
            Assert.assertEquals(fileString, script.output,
                    String.format("Output file didn't match (%d vs %d): %s",
                            fileString.length(), script.output.length(), script));

            String bufferString = result.getStdout().getBufferString();
            Assert.assertEquals(bufferString, script.output,
                    String.format("Output content didn't match (%d vs %d): %s",
                            bufferString.length(), script.output.length(), script));

            Assert.assertFalse(result.getStdout().isBufferTruncated(),
                    "Output content was truncated: " + script);
        }
    } finally {
        FileUtils.deleteQuietly(scriptFile);
        FileUtils.deleteQuietly(outputFile);
    }
}
 
Example 16
Source File: WhiteSpaceWithQueryParamsTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private void verifyDeletion(String employeeNumber) throws AxisFault {
    OMElement payload = fac.createOMElement("employeesByNumber", omNs);

    OMElement empNo = fac.createOMElement("employeeNumber", omNs);
    empNo.setText(employeeNumber);
    payload.addChild(empNo);

    OMElement result = new AxisServiceClient().sendReceive(payload, serviceEndPoint, "employeesByNumber");
    Assert.assertFalse(result.toString().contains("<employee>"), "Employee record found. deletion is now working fine");
}
 
Example 17
Source File: ESBJAVA3751UriTemplateReservedCharacterEncodingTest.java    From product-ei with Apache License 2.0 5 votes vote down vote up
@Test(groups = { "wso2.esb" }, description = "Sending http request with a query param consist of" +
        " reserved + character ")
public void testURITemplateParameterDecodingWithPercentEncodingEscapedAtExpansion() throws Exception {
    boolean isPercentEncoded = false;
    boolean isMessageContextPropertyPercentDecoded = false;
    logViewerClient.clearLogs();
    HttpResponse response = HttpRequestUtil.sendGetRequest(
            getApiInvocationURL("services/client/escapeUrlEncoded?queryParam=ESB+WSO2"),
            null);
    String decodedMessageContextProperty="decodedQueryParamValue = ESB+WSO2";
    LogEvent[] logs = logViewerClient.getAllRemoteSystemLogs();

    //introduced since clearLogs() is not clearing previoues URL call logs, and need to stop
    // searching after 4 messages
    int count = 0;
    for (LogEvent logEvent : logs) {
        String message = logEvent.getMessage();
        if (count++ >= 4) {
            break;
        }
        if (message.contains(decodedMessageContextProperty)) {
            isMessageContextPropertyPercentDecoded = true;
            continue;
        }
        if (message.contains("ESB%2BWSO2")) {
            isPercentEncoded = true;
            continue;
        }
    }
    Assert.assertTrue(isMessageContextPropertyPercentDecoded,
            "Uri-Template parameters should be percent decoded at message context property");
    Assert.assertFalse(isPercentEncoded,
            "Reserved character should not be percent encoded while uri-template expansion");
}
 
Example 18
Source File: RunningTest.java    From scheduler with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void testEquals() {
    Model mo = new DefaultModel();
    VM vm = mo.newVM();
    Running s = new Running(vm);

    Assert.assertTrue(s.equals(s));
    Assert.assertTrue(new Running(vm).equals(s));
    Assert.assertEquals(new Running(vm).hashCode(), s.hashCode());
    Assert.assertFalse(new Running(mo.newVM()).equals(s));
}
 
Example 19
Source File: PlantumlDocumentationCodegenTest.java    From openapi-generator with Apache License 2.0 4 votes vote down vote up
@Test
public void aggregatedEntitiesTest() {
    OpenAPI openAPI = TestUtils.createOpenAPI();
    final Schema simpleDataTypeSchema = new Schema()
            .description("a simple model")
            .addProperties("name", new StringSchema());

    openAPI.getComponents().addSchemas("simple", simpleDataTypeSchema);

    final Schema tagDataTypeSchema = new Schema()
            .description("a tag model")
            .addProperties("name", new StringSchema());

    openAPI.getComponents().addSchemas("tag", tagDataTypeSchema);

    final Schema parentSchema = new Schema()
            .description("a parent model")
            .addProperties("id", new StringSchema())
            .addProperties("name", new Schema().$ref("#/components/schemas/simple"))
            .addProperties("tags", new ArraySchema().items(new Schema().$ref("#/components/schemas/tag")))
            .addRequiredItem("id");

    openAPI.getComponents().addSchemas("parent", parentSchema);

    plantumlDocumentationCodegen.setOpenAPI(openAPI);
    final CodegenModel simpleModel = plantumlDocumentationCodegen.fromModel("simple", simpleDataTypeSchema);
    final CodegenModel tagModel = plantumlDocumentationCodegen.fromModel("tag", tagDataTypeSchema);
    final CodegenModel parentModel = plantumlDocumentationCodegen.fromModel("parent", parentSchema);

    Map<String, Object> objs = createObjectsMapFor(parentModel, simpleModel, tagModel);

    plantumlDocumentationCodegen.postProcessSupportingFileData(objs);

    List<Object> entityList = getList(objs, "entities");
    Assert.assertEquals(entityList.size(), 3, "size of entity list");

    Map<String, Object> parentEntity = getEntityFromList("Parent", entityList);

    Map<String, Object> nameField = getFieldFromEntity("name", parentEntity);
    Assert.assertEquals((String)nameField.get("dataType"), "Simple");

    Map<String, Object> tagsField = getFieldFromEntity("tags", parentEntity);
    Assert.assertEquals((String)tagsField.get("dataType"), "List<Tag>");

    List<Object> relationshipList = getList(objs, "relationships");
    Assert.assertEquals(relationshipList.size(), 2, "size of relationship list");

    Map<String, Object> firstRelationship = (Map<String, Object>)relationshipList.get(0);
    Assert.assertEquals((String)firstRelationship.get("parent"), "Parent");
    Assert.assertEquals((String)firstRelationship.get("child"), "Simple");
    Assert.assertEquals((String)firstRelationship.get("name"), "name");
    Assert.assertFalse((boolean)firstRelationship.get("isList"));

    Map<String, Object> secondRelationship = (Map<String, Object>)relationshipList.get(1);
    Assert.assertEquals((String)secondRelationship.get("parent"), "Parent");
    Assert.assertEquals((String)secondRelationship.get("child"), "Tag");
    Assert.assertEquals((String)secondRelationship.get("name"), "tags");
    Assert.assertTrue((boolean)secondRelationship.get("isList"));
}
 
Example 20
Source File: NamespaceTest.java    From Stargraph with MIT License 4 votes vote down vote up
@Test
public void isNotFromMainNamespaceTest() {
    String uri = "http://dbpedia.org/resource/Category:ABC";
    Assert.assertFalse(ns.isFromMainNS(uri));
}