Java Code Examples for org.junit.jupiter.api.Assertions#assertFalse()

The following examples show how to use org.junit.jupiter.api.Assertions#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: ProfilesServiceImplTest.java    From realworld-api-quarkus with MIT License 6 votes vote down vote up
@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());
}
 
Example 2
Source File: RouteValidationTest.java    From nalu with Apache License 2.0 5 votes vote down vote up
@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"));
}
 
Example 3
Source File: AtlasConfigTest.java    From spectator with Apache License 2.0 5 votes vote down vote up
@Test
public void lwcEnabledBadValue() {
  Map<String, String> props = new HashMap<>();
  props.put("atlas.lwc.enabled", "abc");
  AtlasConfig config = props::get;
  Assertions.assertFalse(config.lwcEnabled());
}
 
Example 4
Source File: AtomicMarkableReferenceUnitTest.java    From tutorials with MIT License 5 votes vote down vote up
@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());
}
 
Example 5
Source File: SingularitySchedulerTest.java    From Singularity with Apache License 2.0 5 votes vote down vote up
@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"
  );
}
 
Example 6
Source File: RouteValidationTest.java    From nalu with Apache License 2.0 5 votes vote down vote up
@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"));
}
 
Example 7
Source File: TestAnnotationBuilder.java    From javageci with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example 8
Source File: PlaneAngleTest.java    From commons-numbers with Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example 9
Source File: TestUpdaterService.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@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());
}
 
Example 10
Source File: TestMapperGeneratedClasses.java    From javageci with Apache License 2.0 5 votes vote down vote up
@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"));
}
 
Example 11
Source File: TestIronGolemListener.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
@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());
}
 
Example 12
Source File: AtomicMarkableReferenceUnitTest.java    From tutorials with MIT License 5 votes vote down vote up
@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());
}
 
Example 13
Source File: RouterUtilsTest.java    From nalu with Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example 14
Source File: RouteValidationTest.java    From nalu with Apache License 2.0 5 votes vote down vote up
@Test
void validateStartRoute109() {
  PropertyFactory.get()
                 .register("startShell/startRoute",
                           true,
                           true,
                           false,
                           false);
  Assertions.assertFalse(RouteValidation.validateStartRoute(this.shellConfiguration,
                                                            this.routerConfiguration,
                                                            "/unknownShell/person/detail/parameter01"));
}
 
Example 15
Source File: CameraLogicDefaultMockTest.java    From canon-sdk-java with MIT License 5 votes vote down vote up
@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());
}
 
Example 16
Source File: TagFilterTest.java    From spectator with Apache License 2.0 4 votes vote down vote up
@Test
public void collectFilteredTagName() {
  Predicate<Measurement> filter = new TagMeasurementFilter(null, "tagZ", null);
  Assertions.assertTrue(filter.test(measureAXZ));
  Assertions.assertFalse(filter.test(measureAXY));
}
 
Example 17
Source File: ControllerModelTest.java    From nalu with Apache License 2.0 4 votes vote down vote up
@Test
void match12() {
  ControllerModel cm = this.getControllerModelForMatchingTest("/*/route01",
                                                              "route01");
  Assertions.assertFalse(cm.match("shell01/route02"));
}
 
Example 18
Source File: SingularityDeploysTest.java    From Singularity with Apache License 2.0 4 votes vote down vote up
@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()
  );
}
 
Example 19
Source File: AdlsGen2CloudStorageParametersValidatorTest.java    From cloudbreak with Apache License 2.0 4 votes vote down vote up
@Test
public void testAdlsGen2ParametersValidationWithInvalidAccountName() {
    Assertions.assertFalse(testValidator(create(":?<>;/", null)));
}
 
Example 20
Source File: DefaultCacheViewTests.java    From catnip with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Test
public void isNotEmpty() {
    final DefaultCacheView<String> cache = new DefaultCacheView<>();
    cache.put(123, "some string");
    Assertions.assertFalse(cache.isEmpty());
}