java.lang.AssertionError Java Examples

The following examples show how to use java.lang.AssertionError. 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: ModelViewWithParisModel_.java    From epoxy with Apache License 2.0 6 votes vote down vote up
@Override
public void handlePreBind(final EpoxyViewHolder holder, final ModelViewWithParis object,
    final int position) {
  validateStateHasNotChangedSinceAdded("The model was changed between being added to the controller and being bound.", position);
  if (!Objects.equals(style, object.getTag(R.id.epoxy_saved_view_style))) {
    AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
      public void run() {
        try {
          StyleApplierUtils.Companion.assertSameAttributes(new ModelViewWithParisStyleApplier(object), style, DEFAULT_PARIS_STYLE);
        }
        catch(AssertionError e) {
          throw new IllegalStateException("ModelViewWithParisModel_ model at position " + position + " has an invalid style:\n\n" + e.getMessage());
        }
      }
    } );
  }
}
 
Example #2
Source File: StyleableModelViewModel_.java    From epoxy with Apache License 2.0 6 votes vote down vote up
@Override
public void handlePreBind(final EpoxyViewHolder holder, final StyleableModelView object,
    final int position) {
  validateStateHasNotChangedSinceAdded("The model was changed between being added to the controller and being bound.", position);
  if (!Objects.equals(style, object.getTag(R.id.epoxy_saved_view_style))) {
    AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
      public void run() {
        try {
          StyleApplierUtils.Companion.assertSameAttributes(new StyleableModelViewStyleApplier(object), style, DEFAULT_PARIS_STYLE);
        }
        catch(AssertionError e) {
          throw new IllegalStateException("StyleableModelViewModel_ model at position " + position + " has an invalid style:\n\n" + e.getMessage());
        }
      }
    } );
  }
}
 
Example #3
Source File: CmdLineParser.java    From spork with Apache License 2.0 6 votes vote down vote up
/**
 * Register a command line option.
 * @param c Single character designator for this option.  It cannot be '-'.
 * @param s Full word designator for this option.  This can be null, in which case
 * no long designator will exist for this option.
 * @param ve If REQUIRED, a value will be expected with this option.  If
 * OPTIONAL a value will be accepted if it is seen.
 * @throws AssertionError if there is no short option, or if this option has already been
 * used.
 */
public void registerOpt(char c, String s, ValueExpected ve)
{
    if (c == '-') {
        throw new AssertionError("CmdLineParser:  '-' is not a legal single character designator.");
    }

    Character cc = Character.valueOf(c);
    if (mShort.put(cc, ve) != null) {
        throw new AssertionError("CmdLineParser:  You have already registered option " + cc.toString());
    }

    if (mLong != null) {
        if (mLong.put(s, cc) != null) {
            throw new AssertionError("CmdLineParser:  You have already registered option " + s);
        }
    }
}