Skip to content
Snippets Groups Projects
Commit b2920e43 authored by nilstes's avatar nilstes
Browse files

Dao->Repo

parent de9270e3
No related branches found
No related tags found
No related merge requests found
package myapp.dao; package myapp.repo;
import myapp.data.MyEntity; import myapp.data.MyEntity;
...@@ -6,11 +6,11 @@ import java.util.Arrays; ...@@ -6,11 +6,11 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
* DataAccessObject for the MyEntity-entity * Repository for the MyEntity-entity
* *
* @author nilstes * @author nilstes
*/ */
public class MyEntityDao { public class MyEntityRepo {
/** /**
* Get object with given id * Get object with given id
......
package myapp.dao; package myapp.repo;
import myapp.data.MyEntity; import myapp.data.MyEntity;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class MyEntityDaoTest { public class MyEntityRepoTest {
@Test @Test
public void testThatWeCanReadMyEntityFromDatabase() { public void testThatWeCanReadMyEntityFromDatabase() {
MyEntity e = new MyEntityDao().getMyEntity("id"); MyEntity e = new MyEntityRepo().getMyEntity("id");
assertEquals(e.getName(), "name"); assertEquals(e.getName(), "name");
} }
......
package myapp.view; package myapp.view;
import myapp.dao.MyEntityDao; import myapp.repo.MyEntityRepo;
import myapp.data.MyEntity; import myapp.data.MyEntity;
import java.awt.GridLayout; import java.awt.GridLayout;
...@@ -25,7 +25,7 @@ public class MyWindow extends JFrame { ...@@ -25,7 +25,7 @@ public class MyWindow extends JFrame {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setLayout(new GridLayout(1, 1, 1, 1)); setLayout(new GridLayout(1, 1, 1, 1));
MyEntityDao dao = new MyEntityDao(); MyEntityRepo dao = new MyEntityRepo();
MyEntity object = dao.getMyEntity("id"); MyEntity object = dao.getMyEntity("id");
add(new JLabel(object.getName())); add(new JLabel(object.getName()));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment