Search in sources :

Example 1 with Ad

use of de.spring.example.persistence.domain.Ad in project JavaForFun by gumartinm.

the class AdRespositoryIntegrationShould method find_one_ad_by_id.

@Test
public void find_one_ad_by_id() {
    Ad ad = createAd();
    Ad createdAd = adRepository.save(ad);
    Ad storedAd = adRepository.findOne(createdAd.getId());
    assertThat(createdAd, is(storedAd));
}
Also used : Ad(de.spring.example.persistence.domain.Ad) Test(org.junit.Test)

Example 2 with Ad

use of de.spring.example.persistence.domain.Ad in project JavaForFun by gumartinm.

the class AdTest method whenCallingConstructorWithParametersThenCreateObject.

@Test
public void whenCallingConstructorWithParametersThenCreateObject() {
    Ad ad = createAd();
    assertThat(ad.getAdDescriptions(), is(AD_DESCRIPTIONS));
    assertThat(ad.getAdMobileImage(), is(AD_MOBILE_IMAGE));
    assertThat(ad.getCompanyCategId(), is(COMPANY_CATEG_ID));
    assertThat(ad.getCompanyId(), is(COMPANY_ID));
    assertThat(ad.getCreatedAt(), is(CREATED_AT));
    assertThat(ad.getUpdatedAt(), is(UPDATED_AT));
    assertThat(ad.getId(), is(AD_ID));
}
Also used : Ad(de.spring.example.persistence.domain.Ad) Test(org.junit.Test)

Example 3 with Ad

use of de.spring.example.persistence.domain.Ad in project JavaForFun by gumartinm.

the class AdController method findAll.

@Override
public Flux<Ad> findAll() {
    Flux<Ad> entities = repository.findAll();
    return entities.flatMap(ad -> {
        return Mono.subscriberContext().map(context -> {
            UsernameContext usernameContext = context.get(UsernameContext.class);
            UsernameContext lol = usernameContext;
            return ad;
        });
    });
}
Also used : UsernameContext(de.spring.example.context.UsernameContext) Ad(de.spring.example.persistence.domain.Ad)

Example 4 with Ad

use of de.spring.example.persistence.domain.Ad in project JavaForFun by gumartinm.

the class AdRespositoryIntegrationShould method find_one_ad_by_id_using_native_query.

@Test
public void find_one_ad_by_id_using_native_query() {
    Ad ad = createAd();
    Ad createdAd = adRepository.save(ad);
    Ad storedAd = adRepository.findByIdNativeQuery(createdAd.getId());
    assertThat(createdAd, is(storedAd));
}
Also used : Ad(de.spring.example.persistence.domain.Ad) Test(org.junit.Test)

Example 5 with Ad

use of de.spring.example.persistence.domain.Ad in project JavaForFun by gumartinm.

the class AdRespositoryIntegrationShould method find_one_ad_by_id_using_named_query.

@Test
public void find_one_ad_by_id_using_named_query() {
    Ad ad = createAd();
    Ad createdAd = adRepository.save(ad);
    Ad storedAd = adRepository.findByIdQuery(createdAd.getId());
    assertThat(createdAd, is(storedAd));
}
Also used : Ad(de.spring.example.persistence.domain.Ad) Test(org.junit.Test)

Aggregations

Ad (de.spring.example.persistence.domain.Ad)5 Test (org.junit.Test)4 UsernameContext (de.spring.example.context.UsernameContext)1