Skip to content

Commit

Permalink
Adressed change requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lur1an committed Nov 17, 2022
1 parent 91e996e commit a4b065f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public boolean isEnum(String className) {
* @param pojoClass {@link Class} the class object of the pojo
* @param fieldName {@link String} the name of the field
* @return true if the field is an instance of java.utils.Collections
* @throws NoSuchFieldException indicating something awefully wrong in the used model
* @throws NoSuchFieldException indicating something awfully wrong in the used model
* @throws SecurityException if the field cannot be accessed.
*/
public boolean isCollection(Class<?> pojoClass, String fieldName) throws NoSuchFieldException, SecurityException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public SQLUtil() {
}

/**
* Unwraps type to autogenerate a name for the table following devonf naming convention.
* Unwraps type to autogenerate a name for the table following devonfw naming convention.
*
* @param entityType String that represents the entity class type
* @return parsed table name
Expand Down Expand Up @@ -251,6 +251,8 @@ public static String mapType(String typeString) {

/**
* Extracts the name of the field from the Map whilst checking for name-override in @Column annotation
* @param field Dynamic map for field
* @return simple name for field as String
*/
static private String getFieldName(Map<String, ?> field) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.devonfw.cobigen.templates.devon4j.test.templates;

import com.devonfw.cobigen.api.extension.TextTemplate;
import com.devonfw.cobigen.api.extension.TextTemplateEngine;
import com.devonfw.cobigen.javaplugin.inputreader.JavaInputReader;
import com.devonfw.cobigen.tempeng.freemarker.FreeMarkerTemplateEngine;
import org.junit.Before;
Expand Down Expand Up @@ -53,6 +54,7 @@ public Path getAbsoluteTemplatePath() {
* Creates a template engine for the given template path
*
* @param templateFolderPath Relative path to template folder from project source root
* @return {@link TextTemplateEngine} implementation for Apache FreeMarker.
*/
public FreeMarkerTemplateEngine createEngine(String templateFolderPath) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public class SQLTestDataTypesEntity {
@Column()
private byte[] blob;

@Column()
private Class<?> varchar2;
@Column()
private Class<?> varchar2;

@Column()
private Locale varchar3;
Expand Down Expand Up @@ -318,24 +318,21 @@ public void setBlob(byte[] blob) {
this.blob = blob;
}




/**
/**
* @return varchar2
*/
public Class<?> getVarchar2() {
public Class<?> getVarchar2() {

return this.varchar2;
}
return this.varchar2;
}

/**
/**
* @param varchar2 new value of {@link #getvarchar2}.
*/
public void setVarchar2(Class<?> varchar2) {
public void setVarchar2(Class<?> varchar2) {

this.varchar2 = varchar2;
}
this.varchar2 = varchar2;
}

/**
* @return varchar3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,15 @@
*/
public class SQLUtilTest {

/**
* Tests type mappings between simple Java types and corresponding SQL types
*/
@Test
public void testClassTypeMapping() {

public void testTypeMappings() {
assertThat(SQLUtil.mapType("Class<?>")).isEqualTo("VARCHAR");
}

@Test
public void testByteArray() {

assertThat(SQLUtil.mapType("byte[]")).isEqualTo("BLOB");
}

@Test
public void testTimestamp() {

assertThat(SQLUtil.mapType("Timestamp")).isEqualTo("TIMESTAMP");
}

@Test
public void testTimeZone() {

assertThat(SQLUtil.mapType("TimeZone")).isEqualTo("VARCHAR");
}

@Test
public void testCalendar() {

assertThat(SQLUtil.mapType("Calendar")).isEqualTo("TIMESTAMP");
}

}

0 comments on commit a4b065f

Please sign in to comment.