org.junit.jupiter.api.Assertions#assertFalse()源码实例Demo

下面列出了org.junit.jupiter.api.Assertions#assertFalse() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Test
public void
    givenValidUsernameAndNullForExistentUserLoggedUserId_shouldReturnProfileWithFollowingFieldFalse() {
  String username = "user1";
  Long loggedUserId = null;

  User existingUser =
      new UserBuilder().id(1L).username(username).bio("bio").image("image").build();

  when(usersService.findByUsername(username)).thenReturn(existingUser);

  ProfileData result = profilesService.getProfile(username, loggedUserId);

  Assertions.assertEquals(existingUser.getUsername(), result.getUsername());
  Assertions.assertEquals(existingUser.getBio(), result.getBio());
  Assertions.assertEquals(existingUser.getImage(), result.getImage());
  Assertions.assertFalse(result.isFollowing());
}
 
源代码2 项目: javageci   文件: TestAnnotationBuilder.java
@Test
public void testAnnotationBuilder() throws Exception {
    final var geci = new Geci();
    Assertions.assertFalse(
        geci.source(maven().module("javageci-core").mainSource())
            .source(ANNOTATION_OUTPUT, maven().module("javageci-core-annotations").mainSource())
            .register(AnnotationBuilder.builder()
                .set(ANNOTATION_OUTPUT)
                .in("javax0.geci.core.annotations")
                .build())
            .generate(),
        geci.failed());
}
 
@Test
void setCameraRefToCamera() {
    final CanonCamera canonCamera = new CanonCamera();

    final OpenSessionOption option = new OpenSessionOptionBuilder()
        .setCamera(canonCamera)
        .build();

    Assertions.assertFalse(canonCamera.getCameraRef().isPresent());

    TestUtil.callMethod(MockFactory.initialCanonFactory.getCameraLogic(), "setCameraRefToCamera", new Class[]{EdsCameraRef.class, OpenSessionOption.class}, fakeCamera, option);

    Assertions.assertTrue(canonCamera.getCameraRef().isPresent());
    Assertions.assertEquals(fakeCamera, canonCamera.getCameraRef().get());
}
 
源代码4 项目: nalu   文件: RouteValidationTest.java
@Test
void validateStartRoute109() {
  PropertyFactory.get()
                 .register("startShell/startRoute",
                           true,
                           true,
                           false,
                           false);
  Assertions.assertFalse(RouteValidation.validateStartRoute(this.shellConfiguration,
                                                            this.routerConfiguration,
                                                            "/unknownShell/person/detail/parameter01"));
}
 
源代码5 项目: nalu   文件: RouterUtilsTest.java
@Test
void testMatch159FailOk() {
  String route = "/app/person/:3/edit";
  String with = "/app/person/*";
  PropertyFactory.get()
                 .register("startShell/startRoute",
                           false,
                           true,
                           true,
                           false);
  Assertions.assertFalse(Nalu.match(route,
                                    with,
                                    true));
}
 
@Test
void givenNotCurrentReferenceAndCurrentMark_whenUsingCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() {
    Employee employee = new Employee(123, "Mike");
    AtomicMarkableReference<Employee> employeeNode = new AtomicMarkableReference<Employee>(employee, true);
    Employee newEmployee = new Employee(124, "John");

    Assertions.assertFalse(employeeNode.compareAndSet(new Employee(1234, "Steve"), newEmployee, true, false));
    Assertions.assertEquals(employee, employeeNode.getReference());
    Assertions.assertTrue(employeeNode.isMarked());
}
 
源代码7 项目: Slimefun4   文件: TestIronGolemListener.java
@Test
public void testWithVanillaIron() {
    VanillaItem item = TestUtilities.mockVanillaItem(plugin, Material.IRON_INGOT, true);
    item.register(plugin);

    PlayerInteractEntityEvent event = callIronGolemEvent(EquipmentSlot.HAND, item.getItem());
    Assertions.assertFalse(event.isCancelled());

    PlayerInteractEntityEvent event2 = callIronGolemEvent(EquipmentSlot.OFF_HAND, item.getItem());
    Assertions.assertFalse(event2.isCancelled());
}
 
源代码8 项目: javageci   文件: TestMapperGeneratedClasses.java
@Test
@DisplayName("Test a freshly initialized object referencing itself")
void mapsRecursive() throws NoSuchFieldException, IllegalAccessException {
    Person boy = new Person();
    Field f = Person.class.getDeclaredField("mother");
    f.setAccessible(true);
    f.set(boy, boy);
    Map<String, Object> mapped = boy.toMap();
    Assertions.assertEquals(5, ((Map) mapped.get("mother")).size());
    Assertions.assertSame(mapped, mapped.get("mother"));
    Assertions.assertFalse((Boolean) mapped.get("willMapPublicInherited"));
}
 
源代码9 项目: Slimefun4   文件: TestUpdaterService.java
@Test
public void testUnofficialBuilds() {
    UpdaterService service = new UpdaterService(plugin, "4.20 UNOFFICIAL", file);
    Assertions.assertEquals(SlimefunBranch.UNOFFICIAL, service.getBranch());
    Assertions.assertFalse(service.getBranch().isOfficial());
    Assertions.assertEquals(-1, service.getBuildNumber());
}
 
源代码10 项目: commons-numbers   文件: PlaneAngleTest.java
@Test
void testEquals() {
    final double value = 12345.6789;
    final PlaneAngle a = PlaneAngle.ofRadians(value);
    Assertions.assertTrue(a.equals(a));
    Assertions.assertTrue(a.equals(PlaneAngle.ofRadians(value)));
    Assertions.assertFalse(a.equals(PlaneAngle.ofRadians(Math.nextUp(value))));
    Assertions.assertFalse(a.equals(new Object()));
    Assertions.assertFalse(a.equals(null));
}
 
源代码11 项目: nalu   文件: RouteValidationTest.java
@Test
void validateStartRoute13() {
  PropertyFactory.get()
                 .register("startShell/startRoute",
                           true,
                           true,
                           false,
                           false);
  Assertions.assertFalse(RouteValidation.validateStartRoute(this.shellConfiguration,
                                                            this.routerConfiguration,
                                                            "/application/person/detail/parameter01/parameter02"));
}
 
源代码12 项目: nalu   文件: RouteValidationTest.java
@Test
void validateStartRoute06() {
  PropertyFactory.get()
                 .register("startShell/startRoute",
                           true,
                           true,
                           false,
                           false);
  Assertions.assertFalse(RouteValidation.validateStartRoute(this.shellConfiguration,
                                                            this.routerConfiguration,
                                                            "/application/person/detail/parameter01/parameter02"));
}
 
源代码13 项目: Singularity   文件: SingularitySchedulerTest.java
@Test
public void testLbCleanupOccursOnRequestDelete() {
  configuration.setDeleteRemovedRequestsFromLoadBalancer(true);
  initLoadBalancedRequest();
  initLoadBalancedDeploy();
  startTask(firstDeploy);

  requestResource.deleteRequest(requestId, Optional.empty(), singularityUser);

  testingLbClient.setNextBaragonRequestState(BaragonRequestState.WAITING);

  Assertions.assertFalse(
    requestManager.getCleanupRequests().isEmpty(),
    "Tasks should get cleaned up"
  );
  cleaner.drainCleanupQueue();
  killKilledTasks();

  Assertions.assertFalse(
    requestManager.getCleanupRequests().isEmpty(),
    "The request should get cleaned up"
  );
  cleaner.drainCleanupQueue();

  Assertions.assertFalse(
    requestManager.getLbCleanupRequestIds().isEmpty(),
    "The request should get removed from the load balancer"
  );
}
 
@Test
void givenNotCurrentReferenceAndNotCurrentMark_whenUsingWeakCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() {
    Employee employee = new Employee(123, "Mike");
    AtomicMarkableReference<Employee> employeeNode = new AtomicMarkableReference<Employee>(employee, true);
    Employee newEmployee = new Employee(124, "John");

    Assertions.assertFalse(employeeNode.weakCompareAndSet(new Employee(1234, "Steve"), newEmployee, false, true));
    Assertions.assertEquals(employee, employeeNode.getReference());
    Assertions.assertTrue(employeeNode.isMarked());
}
 
源代码15 项目: spectator   文件: AtlasConfigTest.java
@Test
public void lwcEnabledBadValue() {
  Map<String, String> props = new HashMap<>();
  props.put("atlas.lwc.enabled", "abc");
  AtlasConfig config = props::get;
  Assertions.assertFalse(config.lwcEnabled());
}
 
源代码16 项目: catnip   文件: DefaultCacheViewTests.java
@Test
public void isNotEmpty() {
    final DefaultCacheView<String> cache = new DefaultCacheView<>();
    cache.put(123, "some string");
    Assertions.assertFalse(cache.isEmpty());
}
 
源代码17 项目: spectator   文件: TagFilterTest.java
@Test
public void collectFilteredTagName() {
  Predicate<Measurement> filter = new TagMeasurementFilter(null, "tagZ", null);
  Assertions.assertTrue(filter.test(measureAXZ));
  Assertions.assertFalse(filter.test(measureAXY));
}
 
源代码18 项目: nalu   文件: ControllerModelTest.java
@Test
void match12() {
  ControllerModel cm = this.getControllerModelForMatchingTest("/*/route01",
                                                              "route01");
  Assertions.assertFalse(cm.match("shell01/route02"));
}
 
源代码19 项目: Singularity   文件: SingularityDeploysTest.java
@Test
public void testDeployFails() {
  initRequest();

  SingularityRequest request = requestResource
    .getRequest(requestId, singularityUser)
    .getRequest();

  initFirstDeploy();

  SingularityTask firstTask = launchTask(
    request,
    firstDeploy,
    1,
    TaskState.TASK_RUNNING
  );

  deploy(
    secondDeployId,
    Optional.<Boolean>empty(),
    Optional.of(1),
    Optional.of(false),
    false
  );
  deployChecker.checkDeploys();
  scheduler.drainPendingQueue();
  Assertions.assertEquals(1, taskManager.getPendingTaskIds().size());

  resourceOffers();
  Assertions.assertEquals(
    1,
    taskManager.getActiveTaskIdsForDeploy(requestId, secondDeployId).size()
  );

  SingularityTaskId firstNewTaskId = taskManager
    .getActiveTaskIdsForDeploy(requestId, secondDeployId)
    .get(0);
  statusUpdate(taskManager.getTask(firstNewTaskId).get(), TaskState.TASK_FAILED);

  deployChecker.checkDeploys();

  Assertions.assertFalse(
    taskManager.getCleanupTaskIds().contains(firstTask.getTaskId())
  );
  Assertions.assertEquals(
    DeployState.FAILED,
    deployManager.getDeployResult(requestId, secondDeployId).get().getDeployState()
  );
}
 
@Test
public void testAdlsGen2ParametersValidationWithInvalidAccountName() {
    Assertions.assertFalse(testValidator(create(":?<>;/", null)));
}