下面列出了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());
}
@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());
}
@Test
void validateStartRoute109() {
PropertyFactory.get()
.register("startShell/startRoute",
true,
true,
false,
false);
Assertions.assertFalse(RouteValidation.validateStartRoute(this.shellConfiguration,
this.routerConfiguration,
"/unknownShell/person/detail/parameter01"));
}
@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());
}
@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());
}
@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"));
}
@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());
}
@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));
}
@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"));
}
@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"));
}
@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());
}
@Test
public void lwcEnabledBadValue() {
Map<String, String> props = new HashMap<>();
props.put("atlas.lwc.enabled", "abc");
AtlasConfig config = props::get;
Assertions.assertFalse(config.lwcEnabled());
}
@Test
public void isNotEmpty() {
final DefaultCacheView<String> cache = new DefaultCacheView<>();
cache.put(123, "some string");
Assertions.assertFalse(cache.isEmpty());
}
@Test
public void collectFilteredTagName() {
Predicate<Measurement> filter = new TagMeasurementFilter(null, "tagZ", null);
Assertions.assertTrue(filter.test(measureAXZ));
Assertions.assertFalse(filter.test(measureAXY));
}
@Test
void match12() {
ControllerModel cm = this.getControllerModelForMatchingTest("/*/route01",
"route01");
Assertions.assertFalse(cm.match("shell01/route02"));
}
@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)));
}