Back to project page android-memento.
The source code is released under:
Apache License
If you think the Android project android-memento listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * android-memento-lib https://github.com/twofortyfouram/android-memento * Copyright 2014 two forty four a.m. LLC */* w w w . j ava2 s .c o m*/ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package com.twofortyfouram.memento.provider.sqlite; import junit.framework.TestCase; import android.test.suitebuilder.annotation.SmallTest; /** * Tests {@link SqliteIndexBuilder}. */ public final class SqliteIndexBuilderTest extends TestCase { @SmallTest public static void testSetTableAndColumn_once() { final SqliteIndexBuilder builder = new SqliteIndexBuilder(); builder.setTableName("some_table"); //$NON-NLS-1$ builder.setColumnName("some_column"); //$NON-NLS-1$ assertEquals( "CREATE INDEX some_table_some_column_index ON some_table(some_column)", builder.build()); //$NON-NLS-1$ } @SmallTest public static void testSetTableAndColumn_replace() { final SqliteIndexBuilder builder = new SqliteIndexBuilder(); builder.setTableName("some_table"); //$NON-NLS-1$ builder.setColumnName("some_column"); //$NON-NLS-1$ builder.setTableName("another_table"); //$NON-NLS-1$ builder.setColumnName("another_column"); //$NON-NLS-1$ assertEquals( "CREATE INDEX another_table_another_column_index ON another_table(another_column)", builder.build()); //$NON-NLS-1$ } @SmallTest public static void testBuild_invalid_missing_table_and_column() { final SqliteIndexBuilder builder = new SqliteIndexBuilder(); try { builder.build(); fail(); } catch (final IllegalStateException e) { // Expected exception } } @SmallTest public static void testBuild_invalid_missing_table() { final SqliteIndexBuilder builder = new SqliteIndexBuilder(); builder.setTableName("some_table"); try { builder.build(); fail(); } catch (final IllegalStateException e) { // Expected exception } } @SmallTest public static void testBuild_invalid_missing_column() { final SqliteIndexBuilder builder = new SqliteIndexBuilder(); builder.setColumnName("some_column"); try { builder.build(); fail(); } catch (final IllegalStateException e) { // Expected exception } } }