/** Asserts that two iterables return iterators with the same elements in the same order. If they do not, * an AssertionError is thrown. * @param actual the actual value * @param expected the expected value */ static public void assertEquals(Iterable<?> actual, Iterable<?> expected) { assertEquals(actual, expected, null); }
public void run() { assertEqualsIgnoringOrder(group.getMembers(), ImmutableSet.of(e)); assertAttributeEquals(e, SequenceGroup.SEQUENCE_VALUE, 1); AtomicInteger state = group.sensors().get(SequenceGroup.SEQUENCE_STATE); assertEquals(state.get(), 2); }}); }
/** * Asserts that two objects are equal. * @param actual the actual value * @param expected the expected value * * @throws AssertionError if the values are not equal. */ static public void assertEquals(Object actual, Object expected) { assertEquals(actual, expected, null); }
public void run() { assertEqualsIgnoringOrder(group.getMembers(), ImmutableSet.of(e1, e2, e3, e)); assertAttributeEquals(e, SequenceGroup.SEQUENCE_VALUE, 4); assertAttributeEquals(group, SequenceGroup.SEQUENCE_CURRENT, e); AtomicInteger state = group.sensors().get(SequenceGroup.SEQUENCE_STATE); assertEquals(state.get(), 5); }}); }
/** * Asserts that two Strings are equal. If they are not, * an AssertionError is thrown. * @param actual the actual value * @param expected the expected value */ static public void assertEquals(String actual, String expected) { assertEquals(actual, expected, null); }
@Test public void testGroupWithMatchingFilterReturnsOnlyMatchingMembers() throws Exception { group = app.addChild(EntitySpec.create(SequenceGroup.class) .configure(SequenceGroup.ENTITY_FILTER, EntityPredicates.displayNameEqualTo("test-one"))); createTestEntities(); app.start(ImmutableList.of(loc1)); assertAttributeEqualsEventually(group, SequenceGroup.RUNNING, true); assertEqualsIgnoringOrder(group.getMembers(), ImmutableList.of(e1)); assertAttributeEquals(e1, SequenceGroup.SEQUENCE_VALUE, 1); AtomicInteger state = group.sensors().get(SequenceGroup.SEQUENCE_STATE); assertEquals(state.get(), 2); }
/** * Asserts that two booleans are equal. If they are not, * an AssertionError is thrown. * @param actual the actual value * @param expected the expected value */ static public void assertEquals(boolean actual, boolean expected) { assertEquals(actual, expected, null); }
/** * Asserts that two collections contain the same elements in the same order. If they do not, * an AssertionError is thrown. * * @param actual the actual value * @param expected the expected value */ static public void assertEquals(Collection<?> actual, Collection<?> expected) { assertEquals(actual, expected, null); }
/** Asserts that two iterators return the same elements in the same order. If they do not, * an AssertionError is thrown. * Please note that this assert iterates over the elements and modifies the state of the iterators. * @param actual the actual value * @param expected the expected value */ static public void assertEquals(Iterator<?> actual, Iterator<?> expected) { assertEquals(actual, expected, null); }
/** * Asserts that two ints are equal. If they are not, * an AssertionError is thrown. * @param actual the actual value * @param expected the expected value */ static public void assertEquals(int actual, int expected) { assertEquals(actual, expected, null); }
/** * Asserts that two booleans are equal. If they are not, * an AssertionError, with the given message, is thrown. * @param actual the actual value * @param expected the expected value * @param message the assertion error message */ static public void assertEquals(boolean actual, boolean expected, String message) { assertEquals( Boolean.valueOf(actual), Boolean.valueOf(expected), message); }
/** * Asserts that two longs are equal. If they are not, * an AssertionError, with the given message, is thrown. * @param actual the actual value * @param expected the expected value * @param message the assertion error message */ static public void assertEquals(long actual, long expected, String message) { assertEquals(Long.valueOf(actual), Long.valueOf(expected), message); }
/** * Asserts that two shorts are equal. If they are not, * an AssertionFailedError, with the given message, is thrown. * @param actual the actual value * @param expected the expected value * @param message the assertion error message */ static public void assertEquals(short actual, short expected, String message) { assertEquals(Short.valueOf(actual), Short.valueOf(expected), message); }
@Override public void run() { Collection<Entity> members = group.getMembers(); assertEquals(members.size(), expected, "members=" + members); }}); }
private void assertPasswordLength(Entity entity, AttributeSensor<String> password, int expectedLength) { String attribute_1 = entity.getAttribute(password); Asserts.assertEquals(attribute_1.length(), expectedLength); }
protected void assertSucceeds(List<Map<String, Object>> assertions, HostAndPort endpoint) { Maybe<Object> checkReachableMaybe = getOnlyAssertionsValue(assertions, REACHABLE_KEY); boolean checkReachable = checkReachableMaybe.isAbsentOrNull() || Boolean.TRUE.equals(TypeCoercions.coerce(checkReachableMaybe.get(), Boolean.class)); boolean reachable = Networking.isReachable(endpoint); Asserts.assertEquals(reachable, checkReachable, endpoint+" "+(reachable ? "" : "not ")+"reachable"); }
public void testCatalogCreate()throws Exception { final Response response = api.getCatalogApi().createFromUpload(getFileContentsAsString("catalog/test-catalog.bom").getBytes(), false); Asserts.assertEquals(response.getStatus(), 201); Asserts.assertStringContains(String.valueOf(response.getEntity()), "simple-tomcat:1.0"); }
@Test public void testReadConfigInheritance_2016_11() throws Exception { doReadConfigInheritance("basic-2016-11", "kmpez5fznt"); checkNewAppNonInheritingKey1(rebindedApp); String origMementoTidied = origMemento.substring(origMemento.indexOf("<entity>")); origMementoTidied = Strings.replaceAllNonRegex(origMementoTidied, "VERSION", BrooklynVersion.get()); Asserts.assertEquals(origMementoTidied, newMemento.replaceAll("\n.*searchPath.*\n", "\n")); }
@Test public void testDeployBlueprint() throws Exception { server.enqueue(taskSummaryResponse()); server.play(); BrooklynApi api = BrooklynApi.newInstance(server.getUrl("/").toString()); BrooklynApiUtil.deployBlueprint(api, YAML); RecordedRequest request = server.takeRequest(); assertEquals(request.getPath(), "/v1/applications"); assertEquals(request.getMethod(), "POST"); assertEquals(new String(request.getBody()), YAML); }
@Test public void testCreatePasswordCreatesAPasswordOfDefaultLength() { final CreatePasswordSensor sensor = new CreatePasswordSensor(ConfigBag.newInstance() .configure(CreatePasswordSensor.SENSOR_NAME, SENSOR_STRING.getName())); sensor.apply(entity); String password = entity.getAttribute(SENSOR_STRING); Asserts.assertEquals(password.length(), 12); } }