Package info.archinnov.achilles.test.mapping.entity

Examples of info.archinnov.achilles.test.mapping.entity.CompleteBean$UserTweetKey


    }

    @Test
    public void should_refresh() throws Exception {
        // Given
        CompleteBean proxy = new CompleteBean();
        when(refresher.refresh(proxy, context.entityFacade)).thenReturn(achillesFutureEntity);
        when(proxifier.removeProxy(proxy)).thenReturn(entity);
        when(asyncUtils.transformFuture(eq(achillesFutureEntity), isoEntityCaptor.capture(), eq(executorService))).thenReturn(futureEntity);
        when(asyncUtils.transformFuture(eq(futureEntity), isoEntityCaptor.capture(), eq(executorService))).thenReturn(futureEntity);
        when(asyncUtils.buildInterruptible(futureEntity)).thenReturn(achillesFutureEntity);
View Full Code Here


        inOrder.verify(flushContext).triggerInterceptor(meta, context.entity, POST_LOAD);
    }

    @Test
    public void should_initialize() throws Exception {
        CompleteBean actual = facade.initialize(entity);

        assertThat(actual).isSameAs(entity);

        verify(initializer).initializeEntity(entity, meta);
    }
View Full Code Here

  }

  @Test
  public void should_validate_entity() throws Exception {
    // Given
    CompleteBean entity = new CompleteBean();
    when(validator.validate(entity)).thenReturn(new HashSet<ConstraintViolation<CompleteBean>>());

    // When
    interceptor.onEvent(entity);
  }
View Full Code Here

  @SuppressWarnings({ "unchecked" })
  @Test
  public void should_raise_exception_when_bean_validation_error_for_property() throws Exception {
    // Given
    boolean exceptionRaised = false;
    CompleteBean entity = new CompleteBean();
    Path propertyPath = mock(Path.class);
    when(validator.validate(entity)).thenReturn(Sets.<ConstraintViolation<CompleteBean>> newHashSet(violation));
    when(violation.getLeafBean().getClass().getCanonicalName()).thenReturn("className");
    when(violation.getPropertyPath()).thenReturn(propertyPath);
    when(propertyPath.toString()).thenReturn("property");
View Full Code Here

    }

    @Test
    public void should_duplicate_for_new_entity() throws Exception {
        CompleteBean entity = new CompleteBean();
        entity.setId(primaryKey);
        when(meta.forOperations().getPrimaryKey(entity)).thenReturn(primaryKey);
        when(flushContext.duplicate()).thenReturn(flushContext);

        PersistenceContext duplicateContext = context.duplicate(entity);
View Full Code Here

    public void should_generate_set_element_at_index_to_list_with_cas_conditions() throws Exception {
        //Given

        Long id = RandomUtils.nextLong(0,Long.MAX_VALUE);
        Object[] boundValues = new Object[] { "whatever" };
        CompleteBean entity = builder().id(id).buid();
        final CASCondition casCondition = new CASCondition("name", "DuyHai");
        final Pair<Assignments, Object[]> updateClauseAndBoundValues = Pair.create(update(), boundValues);
        final Pair<Where, Object[]> whereClauseAndBoundValues = Pair.create(QueryBuilder.update("table").with(set("name", "DuyHai")).where(QueryBuilder.eq("id",11L)), boundValues);

        when(context.getEntity()).thenReturn(entity);
View Full Code Here

    @Test
    public void should_generate_remove_element_at_index_to_list_update() throws Exception {
        //Given
        Long id = RandomUtils.nextLong(0,Long.MAX_VALUE);
        Object[] boundValues = new Object[] { "whatever" };
        CompleteBean entity = builder().id(id).buid();
        final Pair<Assignments, Object[]> updateClauseAndBoundValues = Pair.create(update(), boundValues);
        final Pair<Where, Object[]> whereClauseAndBoundValues = Pair.create(QueryBuilder.update("table").with(set("name", "DuyHai")).where(QueryBuilder.eq("id",11L)), boundValues);

        when(context.getEntity()).thenReturn(entity);
        when(context.getEntityMeta()).thenReturn(entityMeta);
View Full Code Here

    }

    @Test
    public void should_instantiate() throws Exception {
        //Given
        CompleteBean instance = new CompleteBean();
        when(meta.<CompleteBean>getValueClass()).thenReturn(CompleteBean.class);
        when(invoker.instantiate(CompleteBean.class)).thenReturn(instance);

        //When
        final Object actual = view.instantiate();
View Full Code Here

    }

    @Test
    public void should_get_value_from_field() throws Exception {
        //Given
        CompleteBean entity = new CompleteBean();
        Field name = CompleteBean.class.getDeclaredField("name");

        when(meta.getField()).thenReturn(name);
        when(invoker.getValueFromField(entity, name)).thenReturn("DuyHai");
View Full Code Here

    }

    @Test
    public void should_set_value_to_field() throws Exception {
        //Given
        CompleteBean entity = new CompleteBean();
        Field name = CompleteBean.class.getDeclaredField("name");

        when(meta.getField()).thenReturn(name);

        //When
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.test.mapping.entity.CompleteBean$UserTweetKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.