List of usage examples for java.lang AssertionError AssertionError
public AssertionError()
From source file:io.github.retz.scheduler.TaskBuilder.java
public TaskBuilder setCommand(Job job, Application application) { Protos.CommandInfo commandInfo = appToCommandInfo(application, job, assigned.ports()); builder.setCommand(commandInfo);/*from w ww . j ava 2s . c om*/ if (application.container() instanceof DockerContainer) { Protos.ContainerInfo containerInfo = appToContainerInfo(application); builder.setContainer(containerInfo); } else if (!(application.container() instanceof MesosContainer)) { LOG.error("Unknown container: {}", application.container()); throw new AssertionError(); } return this; }
From source file:org.brutusin.rpc.websocket.WebsocketFilter.java
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpRequest = (HttpServletRequest) request; if (isDisabled || httpRequest.getRequestURI() == null || !(httpRequest.getRequestURI().substring(httpRequest.getContextPath().length()) .startsWith(RpcConfig.getInstance().getPath() + "/wskt"))) { chain.doFilter(request, response); return;//from ww w . j a va 2s . c o m } final Map<String, String[]> fakedParams = Collections.singletonMap("requestId", new String[] { String.valueOf(counter.getAndIncrement()) }); HttpServletRequestWrapper wrappedRequest = new HttpServletRequestWrapper(httpRequest) { @Override public Map<String, String[]> getParameterMap() { return fakedParams; } }; /* * current request is needed for getEndpointInstance(). In glassfish getEndpointInstance() is executed out this filter chain, * but inside whole request-response cycle (controlled by the overall listener that sets and removes GlobalThreadLocal) */ if (GlobalThreadLocal.get() == null) { throw new AssertionError(); } Object securityContext; if (ClassUtils.isPresent("org.springframework.security.core.context.SecurityContextHolder", RpcWebInitializer.class.getClassLoader())) { securityContext = SecurityContextHolder.getContext(); } else { securityContext = null; } GlobalThreadLocal.set(new GlobalThreadLocal(wrappedRequest, securityContext)); // override current request with the one with faked params and security context chain.doFilter(wrappedRequest, response); }
From source file:com.microsoft.services.msa.TokenRequest.java
/** * Constructs a new TokenRequest instance and initializes its parameters. * * @param client the HttpClient to make HTTP requests on * @param clientId the client_id of the calling application *//* www .j a v a 2s .c om*/ public TokenRequest(HttpClient client, String clientId, final OAuthConfig oAuthConfig) { if (client == null) throw new AssertionError(); if (clientId == null) throw new AssertionError(); if (TextUtils.isEmpty(clientId)) throw new AssertionError(); this.client = client; this.clientId = clientId; this.mOAuthConfig = oAuthConfig; }
From source file:co.paralleluniverse.fibers.dropwizard.InstrumentedNHttpClientBuilder.java
@Override public CloseableHttpAsyncClient build() { final CloseableHttpAsyncClient ac = super.build(); return new CloseableHttpAsyncClient() { @Override/* w ww . j a va 2s . c om*/ public boolean isRunning() { return ac.isRunning(); } @Override public void start() { ac.start(); } @Override public <T> Future<T> execute(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, HttpContext context, FutureCallback<T> callback) { final Timer.Context timerContext; try { timerContext = timer(requestProducer.generateRequest()).time(); } catch (IOException | HttpException ex) { throw new AssertionError(); } try { return ac.execute(requestProducer, responseConsumer, context, callback); } finally { timerContext.stop(); } } @Override public void close() throws IOException { ac.close(); } }; }
From source file:com.microsoft.live.TestUtils.java
private TestUtils() { throw new AssertionError(); }
From source file:mulavito.algorithms.shortestpath.ksp.KShortestPathAlgorithm.java
/** * @param source//from w w w .j a v a 2 s .c o m * The source * @param target * The destination * @param k * The number of shortest paths to calculate * @return a list with up to <code>k</code> shortest paths from source to * target or an EMPTY list if target is not reachable from source */ public final List<List<E>> getShortestPaths(final V source, final V target, int k) { if (k < 1) throw new AssertionError(); if (check(source, target)) return new ArrayList<List<E>>(); // Let concrete implementation calculate paths. return getShortestPathsIntern(source, target, k); }
From source file:br.com.nordestefomento.jrimum.utilix.ObjectUtil.java
/** * Construtor privado para previnir a instanciao. * /*w ww .ja v a 2 s. c o m*/ * @throws AssertionError caso haja alguma tentativa de utilizao deste construtor. */ private ObjectUtil() { throw new AssertionError(); }
From source file:com.attribyte.essem.ESReporter.java
/** * Builds the URI to bulk-write to a specified index. * @param indexName The index name./*from w w w. jav a 2 s .c o m*/ * @return The URI. */ private URI buildIndexURI(final String indexName) { try { return new URI(esEndpoint.uri.getScheme(), esEndpoint.uri.getUserInfo(), esEndpoint.uri.getHost(), esEndpoint.uri.getPort(), "/" + indexName + "/_bulk", null, null); } catch (URISyntaxException use) { throw new AssertionError(); } }
From source file:com.xtructure.xutil.valid.strategy.UTestTestValidationStrategy.java
public void processFailureBehavesAsExpected() { Condition predicate = isNotNull(); Object object = null;//from ww w . j a v a 2 s . c om String msg = RandomStringUtils.randomAlphanumeric(10); TestValidationStrategy<Object> vs = new TestValidationStrategy<Object>(predicate); try { vs.validate(object); } catch (AssertionError e) { if (!String.format("%s (%s): %s", TestValidationStrategy.DEFAULT_MSG, object, predicate) .equals(e.getMessage())) { throw new AssertionError(); } } try { vs.validate(object, msg); } catch (AssertionError e) { if (!String.format("%s (%s): %s", msg, object, predicate).equals(e.getMessage())) { throw new AssertionError(); } } }
From source file:com.xtructure.xutil.valid.strategy.UTestStateValidationStrategy.java
public void processFailureBehavesAsExpected() { Condition predicate = isNotNull(); Object object = null;//from w ww . j a va2s . c o m String msg = RandomStringUtils.randomAlphanumeric(10); StateValidationStrategy<Object> vs = new StateValidationStrategy<Object>(predicate); try { vs.validate(object); } catch (IllegalStateException e) { if (!String.format("%s (%s): %s", StateValidationStrategy.DEFAULT_MSG, object, predicate) .equals(e.getMessage())) { throw new AssertionError(); } } try { vs.validate(object, msg); } catch (IllegalStateException e) { if (!String.format("%s (%s): %s", msg, object, predicate).equals(e.getMessage())) { throw new AssertionError(); } } }