public void testVirtualObjectHasTransientPropertiesOnly() { VirtualObject obj = new VirtualObject(); MoreAsserts.assertEmpty(BeanUtil.getProperties(obj, true, true)); } }
public void testColumns() { createDatabase(CREATE_TABLES); Map<String, SQLiteType> columns = databaseStructure.columnsFor("t1"); assertContentsInAnyOrder(columns.keySet(), "id", "name", "r"); }
public void matches(String regex) { MoreAsserts.assertMatchesRegex(regex, textView.getText().toString()); }
public void testFileUploadFromLocalFile() throws Throwable { final Container container = givenContainer(containerRepo); final java.io.File local = givenLocalFile(binaryData); doAsyncTest(new AsyncTest() { @Override public void run() { container.upload(local, new ObjectTestCallback<File>() { @Override public void onSuccess(File file) { assertEquals(local.getName(), file.getName()); notifyFinished(); } }); } }); Log.i(TAG, "Downloading the uploaded file"); byte[] content = download(container, local.getName()); MoreAsserts.assertEquals(binaryData, content); }
private void moveColorWheelPointer(final ColorPicker colorPicker, final int expectedCurrentColor, final int degreesToMove) { final float[] expectedCurrentColorHsv = hsvFrom(expectedCurrentColor); final int currentColor = colorPicker.getColor(); final float[] currentColorHsv = hsvFrom(currentColor); final float[] currentPosition = getCurrentPosition(colorPicker); final float[] newPosition = calculatePosition(colorPicker, currentColorHsv, degreesToMove); assertEquals(expectedCurrentColor, colorPicker.getOldCenterColor()); assertEquals(expectedCurrentColorHsv[0], currentColorHsv[0], 1f); moveColorWheelPointer(currentPosition, newPosition); final int newColor = colorPicker.getColor(); final float[] newColorHsv = hsvFrom(newColor); final float degreesMoved = getDegreesMoved(currentColorHsv, newColorHsv); assertNotEqual(currentColor, newColor); assertEquals(Math.abs(degreesToMove), degreesMoved, 3f); }
public void testTransient() { Trans source = new Trans(); source.setTrans("transient value"); Map<String, Object> properties = BeanUtil.getProperties(source, false, true); MoreAsserts.assertEquals( "getProperties() should have ignored @Transient properties", new HashMap<String, Object>().entrySet(), properties.entrySet()); properties.put("trans", source.getTrans()); Trans target = new Trans(); BeanUtil.setProperties(target, properties, true); assertNull( "setProperties() should have ignored @Transient properties", target.getTrans()); }
public void test05SettingsShouldSurviveRestart() { solo.sleep(500); assertNotEqual(originalOwnColor, newOwnColor); assertNotEqual(originalSystemColor, newSystemColor); checkTextColor("This is my second new color", newOwnColor); checkTextColor("This is the second new info color", newSystemColor); openSettings(); checkPreviewColor(newOwnColor, 0); checkPreviewColor(newSystemColor, 1); RobotiumTestUtils.goHome(solo); RobotiumTestUtils.quit(solo); solo.sleep(500); RobotiumTestUtils.launchMainChat(this); solo.sleep(500); sendOwnMessage("This is my saved color"); checkTextColor("This is my saved color", newOwnColor); checkTextColor("*** Welcome to KouChat", newSystemColor); openSettings(); checkPreviewColor(newOwnColor, 0); checkPreviewColor(newSystemColor, 1); }
public void testEmptyUniqueConstraints() { createDatabase(CREATE_TABLES); List<Constraint> constraints = databaseStructure.uniqueConstraintsFor("t"); assertEmpty(constraints); }
public void testTables() { createDatabase(CREATE_2_TABLES); List<String> tables = databaseStructure.tables(); assertContentsInAnyOrder(tables, "T", "T2"); }
MoreAsserts.assertEquals(subscriptions, subscriptionsFound);
public void testForeignTable() { createDatabase(CREATE_2_TABLES_WITH_FOREIGN_KEY); List<String> foreignTables = databaseStructure.foreignTablesFor("t2"); assertContentsInAnyOrder(foreignTables, "t"); }
public void testUniqueConstraints() { createDatabase(CREATE_TABLE_WITH_CONSTRAINT); List<Constraint> constraints = databaseStructure.uniqueConstraintsFor("t"); assertContentsInAnyOrder(constraints, new Constraint(Collections.singletonList("const"))); }
public void testUniqueConstraintsForIntegerPrimaryKey() { createDatabase(CREATE_TABLE_WITH_INTEGER_PRIMARY_KEY); List<Constraint> constraints = databaseStructure.uniqueConstraintsFor("t"); assertContentsInAnyOrder(constraints, new Constraint(Collections.singletonList("_id"))); }
public void testMultiColumnUniqueConstraints() { createDatabase(CREATE_TABLE_WITH_MULTI_COLUMN_CONSTRAINT); List<Constraint> constraints = databaseStructure.uniqueConstraintsFor("t"); assertContentsInAnyOrder(constraints, new Constraint(Arrays.asList("name", "desc"))); }