org.assertj.core.api.Assertions Java Examples

The following examples show how to use org.assertj.core.api.Assertions. 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: RlpxAgentTest.java    From besu with Apache License 2.0 6 votes vote down vote up
@Test
public void incomingConnection_deduplicatedWhenAlreadyConnected_peerWithLowerValueNodeId()
    throws ExecutionException, InterruptedException {
  final Bytes localNodeId = Bytes.fromHexString("0x02", EnodeURL.NODE_ID_SIZE);
  final Bytes remoteNodeId = Bytes.fromHexString("0x01", EnodeURL.NODE_ID_SIZE);

  startAgent(localNodeId);

  final Peer peer = createPeer(remoteNodeId);
  final CompletableFuture<PeerConnection> existingConnection = agent.connect(peer);
  final PeerConnection incomingConnection = connection(peer);
  connectionInitializer.simulateIncomingConnection(incomingConnection);

  // New connection should be kept
  Assertions.assertThat(agent.getPeerConnection(peer).get().get()).isEqualTo(incomingConnection);
  assertThat(agent.getConnectionCount()).isEqualTo(1);
  assertThat(existingConnection.get().isDisconnected()).isTrue();
  assertThat(((MockPeerConnection) existingConnection.get()).getDisconnectReason())
      .contains(DisconnectReason.ALREADY_CONNECTED);
}
 
Example #2
Source File: CloudFormationTemplateBuilderTest.java    From cloudbreak with Apache License 2.0 6 votes vote down vote up
@Test
public void buildTestNoOutboundInternetTrafficBothVpcCidrsAndPrefixListsAreGiven() {
    //GIVEN
    //WHEN
    modelContext = new ModelContext()
            .withAuthenticatedContext(authenticatedContext)
            .withStack(cloudStack)
            .withExistingVpc(true)
            .withExistingIGW(true)
            .withExistingSubnetCidr(singletonList(existingSubnetCidr))
            .mapPublicIpOnLaunch(true)
            .withEnableInstanceProfile(true)
            .withInstanceProfileAvailable(true)
            .withOutboundInternetTraffic(OutboundInternetTraffic.DISABLED)
            .withVpcCidrs(List.of("vpccidr1", "vpccidr2"))
            .withPrefixListIds(List.of("prefix1", "prefix2"))
            .withTemplate(awsCloudFormationTemplate);
    String templateString = cloudFormationTemplateBuilder.build(modelContext);

    //THEN
    Assertions.assertThat(JsonUtil.isValid(templateString)).overridingErrorMessage("Invalid JSON: " + templateString).isTrue();
    assertThat(templateString, stringContainsInOrder("SecurityGroupEgress", "vpccidr1", "vpccidr2", "prefix1", "prefix2"));
}
 
Example #3
Source File: FluxZipTest.java    From reactor-core with Apache License 2.0 6 votes vote down vote up
@Test
public void scanSingleSubscriber() {
    CoreSubscriber<Integer> actual = new LambdaSubscriber<>(null, e -> {}, null, null);
    FluxZip.ZipSingleCoordinator<Integer, Integer> main =
new FluxZip.ZipSingleCoordinator<Integer, Integer>(actual, new Object[1], 1, i -> 5);
    FluxZip.ZipSingleSubscriber<Integer> test = new FluxZip.ZipSingleSubscriber<>(main, 0);
    Subscription parent = Operators.emptySubscription();
    test.onSubscribe(parent);

    Assertions.assertThat(test.scan(Scannable.Attr.PARENT)).isSameAs(parent);
    Assertions.assertThat(test.scan(Scannable.Attr.ACTUAL)).isSameAs(main);
    test.onNext(7);
    Assertions.assertThat(test.scan(Scannable.Attr.BUFFERED)).isEqualTo(1);
    Assertions.assertThat(test.scan(Scannable.Attr.TERMINATED)).isTrue();
    Assertions.assertThat(test.scan(Scannable.Attr.CANCELLED)).isTrue();
}
 
Example #4
Source File: ChargeRepository_Test.java    From estatio with Apache License 2.0 6 votes vote down vote up
@Test
public void newCharge_whenDoesNotExist() {

    existingCharge = null;

    context.checking(new Expectations() {
        {
            oneOf(mockServiceRegistry2).injectServicesInto(with(any(Charge.class)));
            oneOf(mockRepositoryService).persistAndFlush(with(any(Charge.class)));
        }
    });

    final Charge newCharge = chargeRepository.upsert("CG-REF", "CG-Name", "CG-Description",
            newApplicationTenancy("/it"), Applicability.IN_AND_OUT, tax, chargeGroup
    );
    Assertions.assertThat(newCharge.getReference()).isEqualTo("CG-REF");
    Assertions.assertThat(newCharge.getName()).isEqualTo("CG-Name");
    Assertions.assertThat(newCharge.getDescription()).isEqualTo("CG-Description");
    Assertions.assertThat(newCharge.getTax()).isEqualTo(tax);
    Assertions.assertThat(newCharge.getGroup()).isEqualTo(chargeGroup);
}
 
Example #5
Source File: ClusteringActionIT.java    From elasticsearch-carrot2 with Apache License 2.0 6 votes vote down vote up
public void testPropagatingAlgorithmException() {
    // The query should result in an error.
    try {
        // Out of allowed range (should cause an exception).
        Map<String,Object> attrs = new HashMap<>();
        attrs.put("ignoreWordIfInHigherDocsPercent", Double.MAX_VALUE);

        new ClusteringActionRequestBuilder(client)
            .setQueryHint("")
            .addSourceFieldMapping("title", LogicalField.TITLE)
            .addSourceFieldMapping("content", LogicalField.CONTENT)
            .setAlgorithm(STCClusteringAlgorithm.NAME)
            .addAttributes(attrs)
            .setSearchRequest(
              client.prepareSearch()
                    .setIndices(INDEX_TEST)
                    .setSize(100)
                    .setQuery(QueryBuilders.termQuery("content", "data"))
                    .setFetchSource(new String[] {"title", "content"}, null))
            .execute().actionGet();
        throw Preconditions.unreachable();
    } catch (ElasticsearchException e) {
        Assertions.assertThat(e)
            .hasMessageContaining("Clustering error:");
    }
}
 
Example #6
Source File: RolloutManagementTest.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Test
@Description("Weight is validated and saved to the Rollout.")
public void weightValidatedAndSaved() {
    final String targetPrefix = UUID.randomUUID().toString();
    testdataFactory.createTargets(4, targetPrefix);
    enableMultiAssignments();

    Assertions.assertThatExceptionOfType(ConstraintViolationException.class)
            .isThrownBy(() -> createTestRolloutWithTargetsAndDistributionSet(4, 2, "50", "80",
                    UUID.randomUUID().toString(), UUID.randomUUID().toString(), Action.WEIGHT_MAX + 1));
    Assertions.assertThatExceptionOfType(ConstraintViolationException.class)
            .isThrownBy(() -> createTestRolloutWithTargetsAndDistributionSet(4, 2, "50", "80",
                    UUID.randomUUID().toString(), UUID.randomUUID().toString(), Action.WEIGHT_MIN - 1));
    final Rollout createdRollout1 = createTestRolloutWithTargetsAndDistributionSet(4, 2, "50", "80",
            UUID.randomUUID().toString(), UUID.randomUUID().toString(), Action.WEIGHT_MAX);
    final Rollout createdRollout2 = createTestRolloutWithTargetsAndDistributionSet(4, 2, "50", "80",
            UUID.randomUUID().toString(), UUID.randomUUID().toString(), Action.WEIGHT_MIN);
    assertThat(rolloutRepository.findById(createdRollout1.getId()).get().getWeight()).get()
            .isEqualTo(Action.WEIGHT_MAX);
    assertThat(rolloutRepository.findById(createdRollout2.getId()).get().getWeight()).get()
            .isEqualTo(Action.WEIGHT_MIN);
}
 
Example #7
Source File: HystrixBuilderTest.java    From feign with Apache License 2.0 6 votes vote down vote up
@Test
public void rxObservableIntFallback() {
  server.enqueue(new MockResponse().setResponseCode(500));

  final TestInterface api = target();

  final Observable<Integer> observable = api.intObservable();

  assertThat(observable).isNotNull();
  assertThat(server.getRequestCount()).isEqualTo(0);

  final TestSubscriber<Integer> testSubscriber = new TestSubscriber<Integer>();
  observable.subscribe(testSubscriber);
  testSubscriber.awaitTerminalEvent();
  Assertions.assertThat(testSubscriber.getOnNextEvents().get(0)).isEqualTo(new Integer(0));
}
 
Example #8
Source File: SnapshotServiceTest.java    From cassandra-reaper with Apache License 2.0 6 votes vote down vote up
@Test
public void testTakeSnapshot() throws InterruptedException, ReaperException, ClassNotFoundException, IOException {

  JmxProxy proxy = (JmxProxy) mock(Class.forName("io.cassandrareaper.jmx.JmxProxyImpl"));
  StorageServiceMBean storageMBean = Mockito.mock(StorageServiceMBean.class);
  JmxProxyTest.mockGetStorageServiceMBean(proxy, storageMBean);

  AppContext cxt = new AppContext();
  cxt.config = TestRepairConfiguration.defaultConfig();
  cxt.jmxConnectionFactory = mock(JmxConnectionFactory.class);
  when(cxt.jmxConnectionFactory.connectAny(any(Collection.class))).thenReturn(proxy);

  Pair<Node,String> result = SnapshotService
      .create(cxt, SNAPSHOT_MANAGER_EXECUTOR)
      .takeSnapshot("Test", Node.builder().withHostname("127.0.0.1").build());

  Assertions.assertThat(result.getLeft().getHostname()).isEqualTo("127.0.0.1");
  Assertions.assertThat(result.getRight()).isEqualTo("Test");
  verify(storageMBean, times(1)).takeSnapshot("Test");
}
 
Example #9
Source File: ClusterTest.java    From cassandra-reaper with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreate_4() {
  Cluster cluster = Cluster.builder()
      .withName("test")
      .withSeedHosts(ImmutableSet.of("127.0.0.1", "127.0.0.2"))
      .withPartitioner("murmur3")
      .withJmxPort(9999)
      .withState(Cluster.State.ACTIVE)
      .build();

  Assertions.assertThat(cluster.getName()).isEqualTo("test");
  Assertions.assertThat(cluster.getSeedHosts()).hasSize(2);
  Assertions.assertThat(cluster.getSeedHosts()).contains("127.0.0.1", "127.0.0.2");
  Assertions.assertThat(cluster.getPartitioner()).isPresent();
  Assertions.assertThat(cluster.getPartitioner().get()).isEqualTo("murmur3");
  Assertions.assertThat(cluster.getJmxPort()).isEqualTo(9999);
  Assertions.assertThat(cluster.getState()).isEqualTo(Cluster.State.ACTIVE);
  Assertions.assertThat(cluster.getLastContact()).isEqualTo(LocalDate.MIN);
}
 
Example #10
Source File: AssembleSingleProviderImplTest.java    From business with Mozilla Public License 2.0 6 votes vote down vote up
@Test
public void testToDtos() {
    underTest2 = new AssembleMultipleImpl<>(context, Stream.of(new Order("lightsaber"), new Order("death star")),
            null);

    List<OrderDto> orderDtos = underTest2.toListOf(OrderDto.class);
    Assertions.assertThat(orderDtos)
            .isNotNull();
    Assertions.assertThat(orderDtos)
            .isNotEmpty();
    Assertions.assertThat(orderDtos.get(0)
            .getProduct())
            .isEqualTo("lightsaber");
    Assertions.assertThat(orderDtos.get(1)
            .getProduct())
            .isEqualTo("death star");
}
 
Example #11
Source File: TestHiveCreateTable.java    From presto with Apache License 2.0 6 votes vote down vote up
@Test(groups = STORAGE_FORMATS)
public void testCreateTable()
        throws SQLException
{
    onPresto().executeQuery("CREATE TABLE test_create_table(a bigint, b varchar, c smallint) WITH (format='ORC')");
    onPresto().executeQuery("INSERT INTO test_create_table(a, b, c) VALUES " +
            "(NULL, NULL, NULL), " +
            "(-42, 'abc', SMALLINT '-127'), " +
            "(9223372036854775807, 'abcdefghijklmnopqrstuvwxyz', SMALLINT '32767')");
    assertThat(onPresto().executeQuery("SELECT * FROM test_create_table"))
            .containsOnly(
                    row(null, null, null),
                    row(-42, "abc", -127),
                    row(9223372036854775807L, "abcdefghijklmnopqrstuvwxyz", 32767));
    Assertions.assertThat(getTableProperty("test_create_table", "transactional"))
            // Hive 3 removes "transactional" table property when it has value "false"
            .isIn(Optional.empty(), Optional.of("false"));
    onPresto().executeQuery("DROP TABLE test_create_table");
}
 
Example #12
Source File: MergeSingleAggregateFromRepositoryImplTest.java    From business with Mozilla Public License 2.0 6 votes vote down vote up
@Test
public void testOrFailOK() {
    Mockito.when(repository.get("1"))
            .thenReturn(Optional.of(order));

    AggregateRoot<?> aggregateRoot = null;
    try {
        aggregateRoot = underTest.fromRepository()
                .orFail();
    } catch (AggregateNotFoundException e) {
        fail();
    }

    Assertions.assertThat(aggregateRoot)
            .isNotNull();
    Assertions.assertThat(aggregateRoot)
            .isEqualTo(order);

    Assertions.assertThat(((Order) aggregateRoot).getProduct())
            .isEqualTo("lightsaber");
}
 
Example #13
Source File: ToolTipBuilderTest.java    From beakerx with Apache License 2.0 6 votes vote down vote up
@Test
public void setToolTipBuilderWithOneParam_hasToolTip() {
  //given
  ToolTipBuilder toolTipBuilder = new ToolTipBuilder() {

    @Override
    public Object call(Object x) {
      return "x=" + x;
    }

    @Override
    public int getMaximumNumberOfParameters() {
      return 1;
    }
  };
  //when
  xyGraphics.setToolTip(toolTipBuilder);
  //then
  Assertions.assertThat(xyGraphics.getToolTips().get(0)).isEqualTo("x=10");
}
 
Example #14
Source File: StreamListenerHandlerBeanTests.java    From spring-cloud-stream with Apache License 2.0 6 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void testHandlerBean() throws Exception {
	ConfigurableApplicationContext context = SpringApplication.run(this.configClass,
			"--spring.cloud.stream.bindings.output.contentType=application/json",
			"--server.port=0");
	MessageCollector collector = context.getBean(MessageCollector.class);
	Processor processor = context.getBean(Processor.class);
	String id = UUID.randomUUID().toString();
	processor.input()
			.send(MessageBuilder.withPayload("{\"foo\":\"barbar" + id + "\"}")
					.setHeader("contentType", "application/json").build());
	HandlerBean handlerBean = context.getBean(HandlerBean.class);
	Assertions.assertThat(handlerBean.receivedPojos).hasSize(1);
	Assertions.assertThat(handlerBean.receivedPojos.get(0))
			.hasFieldOrPropertyWithValue("foo", "barbar" + id);
	Message<String> message = (Message<String>) collector
			.forChannel(processor.output()).poll(1, TimeUnit.SECONDS);
	assertThat(message).isNotNull();
	assertThat(message.getPayload()).isEqualTo("{\"bar\":\"barbar" + id + "\"}");
	assertThat(message.getHeaders().get(MessageHeaders.CONTENT_TYPE, MimeType.class)
			.includes(MimeTypeUtils.APPLICATION_JSON));
	context.close();
}
 
Example #15
Source File: DirectoryAssert.java    From smart-testing with Apache License 2.0 6 votes vote down vote up
public DirectoryAssert hasSameContentAs(Path path) {
    FileAssert fileAssert = new FileAssert(actual.toFile());
    fileAssert.exists().isDirectory();

    Arrays
        .stream(path.toFile().listFiles())
        .map(File::toPath)
        .forEach(expectedFile -> {
            Path actualFile = actual.resolve(expectedFile.getFileName());
            if (expectedFile.toFile().isDirectory()) {
                assertThatDirectory(actualFile).hasSameContentAs(expectedFile);
            } else {
                Assertions.assertThat(actualFile).exists().isRegularFile().hasSameContentAs(expectedFile);
            }
        });

    return this;
}
 
Example #16
Source File: PaymentBatch_Test.java    From estatio with Apache License 2.0 6 votes vote down vote up
@Test
public void concatRemittanceInformation_works() throws Exception {

    // given
    PaymentBatch paymentBatch = new PaymentBatch();
    // when
    List<PaymentLine> lines = new ArrayList<>();
    // then
    Assertions.assertThat(paymentBatch.concatRemittanceInformationAndTruncateIfNeeded(lines)).isEqualTo("");

    // and when
    final PaymentLine line1 = new PaymentLine();
    line1.setRemittanceInformation("info1");
    lines.add(line1);
    // then
    Assertions.assertThat(paymentBatch.concatRemittanceInformationAndTruncateIfNeeded(lines)).isEqualTo("info1");

    // and when
    final PaymentLine line2 = new PaymentLine();
    line2.setRemittanceInformation("info2");
    lines.add(line2);
    // then
    Assertions.assertThat(paymentBatch.concatRemittanceInformationAndTruncateIfNeeded(lines)).isEqualTo("info1;info2");

}
 
Example #17
Source File: ClusterTest.java    From genie with Apache License 2.0 6 votes vote down vote up
/**
 * Test equals.
 */
@Test
void canFindEquality() {
    final Cluster.Builder builder = new Cluster.Builder(NAME, USER, VERSION, ClusterStatus.UP);
    builder.withConfigs(null);
    builder.withDependencies(null);
    builder.withCreated(null);
    builder.withDescription(null);
    builder.withId(UUID.randomUUID().toString());
    builder.withTags(null);
    builder.withUpdated(null);
    final Cluster cluster1 = builder.build();
    final Cluster cluster2 = builder.build();
    builder.withDescription(UUID.randomUUID().toString());
    final Cluster cluster3 = builder.build();
    builder.withId(UUID.randomUUID().toString());
    final Cluster cluster4 = builder.build();

    Assertions.assertThat(cluster1).isEqualTo(cluster2);
    Assertions.assertThat(cluster1).isEqualTo(cluster3);
    Assertions.assertThat(cluster1).isNotEqualTo(cluster4);
}
 
Example #18
Source File: BatchHistoricDecisionInstanceDeletionTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldSetInvocationsPerBatchType() {
  // given
  configuration.getInvocationsPerBatchJobByBatchType()
      .put(Batch.TYPE_HISTORIC_DECISION_INSTANCE_DELETION, 42);

  HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery()
      .decisionDefinitionKey(DECISION);

  // when
  Batch batch = historyService.deleteHistoricDecisionInstancesAsync(query, null);

  // then
  Assertions.assertThat(batch.getInvocationsPerBatchJob()).isEqualTo(42);

  // clear
  configuration.setInvocationsPerBatchJobByBatchType(new HashMap<>());
}
 
Example #19
Source File: JsonHomeScanTest.java    From seed with Mozilla Public License 2.0 6 votes vote down vote up
@Before
public void before() {
    new Expectations() {
        {
            restConfig.getPath();
            result = REST_PATH;
            restConfig.getBaseRel();
            result = BASE_REL;
            restConfig.getBaseParam();
            result = BASE_PARAM;
        }
    };

    ResourceScanner resourceScanner = new ResourceScanner(restConfig, SERVLET_CONTEXT_PATH);
    resourceScanner.scan(Lists.newArrayList(
            MethodResource.class,
            ClassResource.class,
            ClassAndMethodResource.class,
            ClassAndMethodResource2.class,
            ClassAndMethodResource3.class
    ));
    resourceMap = resourceScanner.jsonHomeResources();
    Assertions.assertThat(resourceMap).isNotNull();
}
 
Example #20
Source File: XYGraphicsSerializerTest.java    From beakerx with Apache License 2.0 5 votes vote down vote up
@Test
public void serializeXOfXYGraphicsLine_resultJsonHasX() throws IOException {
  //when
  line.setX(Arrays.asList(1, 2, 3));
  xyGraphicsSerializer.serialize(line, jgen, new DefaultSerializerProvider.Impl());
  jgen.flush();
  //then
  JsonNode actualObj = mapper.readTree(sw.toString());
  Assertions.assertThat(actualObj.has("x")).isTrue();
  Assertions.assertThat(actualObj.get("x")).isNotEmpty();
}
 
Example #21
Source File: GesturePointAssert.java    From assertj-android with Apache License 2.0 5 votes vote down vote up
public GesturePointAssert hasY(float y) {
  isNotNull();
  float actualY = actual.y;
  Assertions.assertThat(actualY) //
      .overridingErrorMessage("Expected Y <%s> but was <%s>.", y, actualY) //
      .isEqualTo(y);
  return this;
}
 
Example #22
Source File: LoganSquareConverterTest.java    From retrofit-logansquare with Apache License 2.0 5 votes vote down vote up
@Test
public void testArray() throws IOException {
    mockWebServer.enqueue(new MockResponse().setBody("{}"));

    // Setup the mock object with an incompatible type argument
    BasicModel[] body = new BasicModel[] { new BasicModel("name", "not", CustomEnum.VAL_2, null)};

    // Setup the API call and fire it
    try {
        service.callArray(body).execute();
        Assertions.failBecauseExceptionWasNotThrown(RuntimeException.class);
    } catch (RuntimeException ignored) {
    }
}
 
Example #23
Source File: InfluxDBClientOptionsTest.java    From influxdb-client-java with MIT License 5 votes vote down vote up
@Test
void authorizationNone() {

    InfluxDBClientOptions options = InfluxDBClientOptions.builder()
            .url("http://localhost:9999")
            .build();

    Assertions.assertThat(options.getAuthScheme()).isNull();
}
 
Example #24
Source File: BarsSerializerTest.java    From beakerx with Apache License 2.0 5 votes vote down vote up
@Test
public void serializeOutlineColorBars_resultJsonHasOutlineColor() throws IOException {
  //when
  bars.setOutlineColor(Color.GREEN);
  barsSerializer.serialize(bars, jgen, new DefaultSerializerProvider.Impl());
  jgen.flush();
  //then
  JsonNode actualObj = mapper.readTree(sw.toString());
  Assertions.assertThat(actualObj.has("outline_color")).isTrue();
  Assertions.assertThat(actualObj.get("outline_color").get("rgb").asInt())
      .isEqualTo(Color.GREEN.getRGB());
}
 
Example #25
Source File: HeatmapHighlighterSerializerTest.java    From beakerx with Apache License 2.0 5 votes vote down vote up
@Test
public void serializeMaxColor_resultJsonHasMaxColor() throws IOException {
  //given
  HeatmapHighlighter heatmapHighlighter =
      (HeatmapHighlighter) TableDisplayCellHighlighter.getHeatmapHighlighter(
          "a", 1, 10, Color.BLACK, Color.BLUE);
  //when
  JsonNode actualObj = serializeHeatmapHighlighter(heatmapHighlighter);
  //then
  Assertions.assertThat(actualObj.has("maxColor")).isTrue();
  Assertions.assertThat(actualObj.get("maxColor").get("rgb").asInt())
      .isEqualTo(Color.BLUE.getRGB());
}
 
Example #26
Source File: AgentConnectionEntityTest.java    From genie with Apache License 2.0 5 votes vote down vote up
/**
 * Test constructor.
 */
@Test
void canCreateAgentConnectionEntityWithConstructor() {
    final AgentConnectionEntity entity = new AgentConnectionEntity(JOB, HOST);
    Assertions.assertThat(entity.getJobId()).isEqualTo(JOB);
    Assertions.assertThat(entity.getServerHostname()).isEqualTo(HOST);
}
 
Example #27
Source File: SparkProgressTest.java    From beakerx with Apache License 2.0 5 votes vote down vote up
@Test
public void sparkProgressSetExecutorIds_hasExecutorIds() throws Exception {
  //when
  sparkProgress.setExecutorIds(executorIds);
  //then
  Assertions.assertThat(sparkProgress.getExecutorIds()).isEqualTo(executorIds);
}
 
Example #28
Source File: PlotObjectSerializerTest.java    From beakerx with Apache License 2.0 5 votes vote down vote up
@Test
public void serializeArrays_returnTrue() throws Exception {
  //when
  boolean result =
      plotObjectSerializer.writeObject(Arrays.asList("v1", "v2"), jgen, true);
  //then
  Assertions.assertThat(result).isTrue();
}
 
Example #29
Source File: JobMetricsServiceImplTest.java    From genie with Apache License 2.0 5 votes vote down vote up
/**
 * Test to make sure the method returns the number of running jobs.
 */
@Test
void canGetNumJobs() {
    Mockito
        .when(this.persistenceService.getAllActiveJobsOnHost(this.hostName))
        .thenReturn(
            Sets.newHashSet(
                Mockito.mock(Job.class),
                Mockito.mock(Job.class),
                Mockito.mock(Job.class)
            )
        );

    Assertions.assertThat(this.jobMetricsService.getNumActiveJobs()).isEqualTo(3);
}
 
Example #30
Source File: SimpleEvaluationObjectTest.java    From beakerx with Apache License 2.0 5 votes vote down vote up
@Test
public void seoFinished_shouldSetPayload() throws Exception {
  //given
  Object payload = new Object();
  //when
  seo.finished(payload);
  //then
  Assertions.assertThat(seo.getPayload()).isEqualTo(payload);
}