Wpis z mikrobloga

Pora zabrać się za testy i przy pierwszej próbie już mi się sypie...
Gdy tworzę sobie sam obiekty i porównuje jest ok test przechodzi, problem pojawia się gdy chce pobrać z db.

@RunWith(SpringRunner.class)
@DataJpaTest
public class Functionality {

Product dupa = new Product();

@Autowired
private ProductDao productDao;

@Before
public void init() {
dupa.setId(22);

}

@Test
public void test() {
assertEquals(dupa, productDao.findOne(22l));
}

}

#java #springboot
  • 6
w sumie dostaje error, ale nie bardzo wiem jak się za to zabrać


@robie_bota: możnaby na przykład spróbować przeczytać treść, to często pomaga :)

17:43:21.917 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [functionality.Functionality]: no resource found for suffixes {-context.xml, Context.groovy}.


17:43:21.932 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [functionality.Functionality]: Functionality does not declare any static, non-private, non-final, nested classes