Package org.dayatang.persistence.test.domain

Examples of org.dayatang.persistence.test.domain.Dictionary


        return category;
    }

    private Dictionary createDictionary(String code, String text, DictionaryCategory category, int sortOrder,
            String parentCode) {
        Dictionary dictionary = new Dictionary(code, text, category);
        dictionary.setSortOrder(sortOrder);
        dictionary.setParentCode(parentCode);
        repository.save(dictionary);
        repository.flush();
        return dictionary;
    }
View Full Code Here


        return dictionary;
    }

    @Test
    public void testAddAndRemove() {
        Dictionary dictionary = new Dictionary("2001", "双硕士", gender);
        assertFalse(dictionary.existed());
        dictionary = repository.save(dictionary);
        assertTrue(dictionary.existed());
        assertNotNull(dictionary.getId());
        repository.remove(dictionary);
        assertNull(repository.get(Dictionary.class, dictionary.getId()));
    }
View Full Code Here

        assertNull(repository.get(Dictionary.class, dictionary.getId()));
    }

    @Test
    public void testValidateFailure() {
        Dictionary dictionary = new Dictionary("", "", gender);
        try {
            dictionary.save();
            repository.flush();
            fail("应抛出异常!");
        } catch (ValidationException e) {
            System.out.println(e.getMessage());
            assertTrue(true);
View Full Code Here

     * Test of getUnmodified method
     */
    @Test
    public void testGetUnmodified() {
        male.setText("xyz");
        Dictionary unmodified = repository.getUnmodified(Dictionary.class, male);
        assertEquals("男", unmodified.getText());
        assertEquals("xyz", male.getText());
    }
View Full Code Here

    @Test
    public void testGetByBusinessKeys() {
        NamedParameters params = NamedParameters.create()
                .add("category", education)
                .add("code", "02");
        Dictionary result = repository.getByBusinessKeys(Dictionary.class, params);
        assertEquals(graduate, result);
    }
View Full Code Here

    /**
     * Test of findByExample method
     */
    @Test
    public void testFindByExample() {
        Dictionary example = new Dictionary(null, "本", null);
        List<Dictionary> dictionaries = repository.findByExample(example, ExampleSettings.create(Dictionary.class).excludeZeroes());
        assertFalse(dictionaries.contains(male));
        assertFalse(dictionaries.contains(undergraduate));
        dictionaries = repository.findByExample(example, ExampleSettings.create(Dictionary.class).excludeZeroes().enableLike());
        assertTrue(dictionaries.contains(undergraduate));
View Full Code Here

    @Test
    public void testFlush() {
        String description = "Ha Ha Ha!";
        male.setDescription(description);
        repository.flush();
        Dictionary male1 = repository.get(Dictionary.class, male.getId());
        assertEquals(description, male1.getDescription());
    }
View Full Code Here

    @Test
    public void testNotEq() {
        instance.notEq("category", gender);
        List<Dictionary> results = repository.find(instance);
        Dictionary dictionary = results.get(0);
        assertEquals(education, dictionary.getCategory());
    }
View Full Code Here

        return category;
    }

    private Dictionary createDictionary(String code, String text, DictionaryCategory category, int sortOrder,
            String parentCode) {
        Dictionary dictionary = new Dictionary(code, text, category);
        dictionary.setSortOrder(sortOrder);
        dictionary.setParentCode(parentCode);
        repository.save(dictionary);
        repository.flush();
        return dictionary;
    }
View Full Code Here

    }

    @Test
    public void testNotEq() {
        List<Dictionary> results = instance.notEq("category", gender).list();
        Dictionary dictionary = results.get(0);
        assertEquals(education, dictionary.getCategory());
    }
View Full Code Here

TOP

Related Classes of org.dayatang.persistence.test.domain.Dictionary

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.