Fixed ugly inheritance issue with Issue and FileIssue.
Added Filter unit tests.
This commit is contained in:
parent
7ff8806544
commit
ce35e14694
@ -1,9 +1,9 @@
|
||||
#Sat Feb 20 22:25:08 CST 2010
|
||||
#Sun Feb 21 15:42:19 CST 2010
|
||||
build.dir=build
|
||||
src.dir=src
|
||||
lib.shared.dir=../shared-libs
|
||||
test.dir=test
|
||||
build.number=53
|
||||
build.number=64
|
||||
expected.application.version=1.1.2
|
||||
lib.dir=lib
|
||||
release.dir=release
|
||||
|
Binary file not shown.
@ -33,15 +33,19 @@ if expand('%') == '' && !&modified && line('$') <= 1 && getline(1) == ''
|
||||
endif
|
||||
set shortmess=aoO
|
||||
badd +1 build.xml
|
||||
badd +0 project.properties
|
||||
badd +1 project.properties
|
||||
badd +1 src/com/jdbernard/pit/Category.groovy
|
||||
badd +0 test/com/jdbernard/pit/CategoryTest.groovy
|
||||
badd +1 test/com/jdbernard/pit/CategoryTest.groovy
|
||||
badd +1 src/com/jdbernard/pit/Filter.groovy
|
||||
badd +0 test/com/jdbernard/pit/FilterTest.groovy
|
||||
badd +1 test/com/jdbernard/pit/FilterTest.groovy
|
||||
badd +1 src/com/jdbernard/pit/Issue.groovy
|
||||
badd +0 test/com/jdbernard/pit/IssueTest.groovy
|
||||
badd +1 src/com/jdbernard/pit/Project.groovy
|
||||
badd +0 test/com/jdbernard/pit/ProjectTest.groovy
|
||||
badd +1 test/com/jdbernard/pit/IssueTest.groovy
|
||||
badd +6 src/com/jdbernard/pit/Project.groovy
|
||||
badd +1 test/com/jdbernard/pit/ProjectTest.groovy
|
||||
badd +1 src/com/jdbernard/pit/FileIssue.groovy
|
||||
badd +0 test/com/jdbernard/pit/FileIssueTest.groovy
|
||||
badd +1 src/com/jdbernard/pit/FileProject.groovy
|
||||
badd +0 test/com/jdbernard/pit/FileProjectTest.groovy
|
||||
args build.xml
|
||||
edit build.xml
|
||||
set splitbelow splitright
|
||||
@ -151,7 +155,7 @@ setlocal nowinfixwidth
|
||||
setlocal wrap
|
||||
setlocal wrapmargin=0
|
||||
silent! normal! zE
|
||||
let s:l = 1 - ((0 * winheight(0) + 28) / 57)
|
||||
let s:l = 1 - ((0 * winheight(0) + 39) / 78)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
@ -255,14 +259,13 @@ setlocal nowinfixwidth
|
||||
setlocal wrap
|
||||
setlocal wrapmargin=0
|
||||
silent! normal! zE
|
||||
let s:l = 1 - ((0 * winheight(0) + 28) / 57)
|
||||
let s:l = 1 - ((0 * winheight(0) + 39) / 78)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
1
|
||||
normal! 0
|
||||
wincmd w
|
||||
2wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 91 + 91) / 182)
|
||||
exe 'vert 2resize ' . ((&columns * 90 + 91) / 182)
|
||||
tabedit src/com/jdbernard/pit/Category.groovy
|
||||
@ -373,7 +376,7 @@ setlocal nowinfixwidth
|
||||
setlocal wrap
|
||||
setlocal wrapmargin=0
|
||||
silent! normal! zE
|
||||
let s:l = 1 - ((0 * winheight(0) + 28) / 57)
|
||||
let s:l = 1 - ((0 * winheight(0) + 39) / 78)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
@ -477,14 +480,13 @@ setlocal nowinfixwidth
|
||||
setlocal wrap
|
||||
setlocal wrapmargin=0
|
||||
silent! normal! zE
|
||||
let s:l = 1 - ((0 * winheight(0) + 28) / 57)
|
||||
let s:l = 1 - ((0 * winheight(0) + 39) / 78)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
1
|
||||
normal! 0
|
||||
wincmd w
|
||||
2wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 91 + 91) / 182)
|
||||
exe 'vert 2resize ' . ((&columns * 90 + 91) / 182)
|
||||
tabedit src/com/jdbernard/pit/Filter.groovy
|
||||
@ -595,7 +597,7 @@ setlocal nowinfixwidth
|
||||
setlocal wrap
|
||||
setlocal wrapmargin=0
|
||||
silent! normal! zE
|
||||
let s:l = 1 - ((0 * winheight(0) + 28) / 57)
|
||||
let s:l = 1 - ((0 * winheight(0) + 39) / 78)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
@ -699,14 +701,13 @@ setlocal nowinfixwidth
|
||||
setlocal wrap
|
||||
setlocal wrapmargin=0
|
||||
silent! normal! zE
|
||||
let s:l = 1 - ((0 * winheight(0) + 28) / 57)
|
||||
let s:l = 103 - ((26 * winheight(0) + 39) / 78)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
1
|
||||
normal! 0
|
||||
103
|
||||
normal! 04l
|
||||
wincmd w
|
||||
2wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 91 + 91) / 182)
|
||||
exe 'vert 2resize ' . ((&columns * 90 + 91) / 182)
|
||||
tabedit src/com/jdbernard/pit/Issue.groovy
|
||||
@ -817,7 +818,7 @@ setlocal nowinfixwidth
|
||||
setlocal wrap
|
||||
setlocal wrapmargin=0
|
||||
silent! normal! zE
|
||||
let s:l = 1 - ((0 * winheight(0) + 28) / 57)
|
||||
let s:l = 1 - ((0 * winheight(0) + 39) / 78)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
@ -825,7 +826,7 @@ normal! zt
|
||||
normal! 0
|
||||
wincmd w
|
||||
argglobal
|
||||
edit test/com/jdbernard/pit/IssueTest.groovy
|
||||
edit src/com/jdbernard/pit/Project.groovy
|
||||
setlocal keymap=
|
||||
setlocal noarabic
|
||||
setlocal autoindent
|
||||
@ -921,17 +922,16 @@ setlocal nowinfixwidth
|
||||
setlocal wrap
|
||||
setlocal wrapmargin=0
|
||||
silent! normal! zE
|
||||
let s:l = 1 - ((0 * winheight(0) + 28) / 57)
|
||||
let s:l = 1 - ((0 * winheight(0) + 39) / 78)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
1
|
||||
normal! 0
|
||||
wincmd w
|
||||
2wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 91 + 91) / 182)
|
||||
exe 'vert 2resize ' . ((&columns * 90 + 91) / 182)
|
||||
tabedit src/com/jdbernard/pit/Project.groovy
|
||||
tabedit src/com/jdbernard/pit/FileIssue.groovy
|
||||
set splitbelow splitright
|
||||
wincmd _ | wincmd |
|
||||
vsplit
|
||||
@ -1039,15 +1039,15 @@ setlocal nowinfixwidth
|
||||
setlocal wrap
|
||||
setlocal wrapmargin=0
|
||||
silent! normal! zE
|
||||
let s:l = 1 - ((0 * winheight(0) + 28) / 57)
|
||||
let s:l = 9 - ((8 * winheight(0) + 39) / 78)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
1
|
||||
normal! 0
|
||||
9
|
||||
normal! 010l
|
||||
wincmd w
|
||||
argglobal
|
||||
edit test/com/jdbernard/pit/ProjectTest.groovy
|
||||
edit test/com/jdbernard/pit/FileIssueTest.groovy
|
||||
setlocal keymap=
|
||||
setlocal noarabic
|
||||
setlocal autoindent
|
||||
@ -1143,17 +1143,238 @@ setlocal nowinfixwidth
|
||||
setlocal wrap
|
||||
setlocal wrapmargin=0
|
||||
silent! normal! zE
|
||||
let s:l = 1 - ((0 * winheight(0) + 28) / 57)
|
||||
let s:l = 1 - ((0 * winheight(0) + 39) / 78)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
1
|
||||
normal! 0
|
||||
wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 91 + 91) / 182)
|
||||
exe 'vert 2resize ' . ((&columns * 90 + 91) / 182)
|
||||
tabedit src/com/jdbernard/pit/FileProject.groovy
|
||||
set splitbelow splitright
|
||||
wincmd _ | wincmd |
|
||||
vsplit
|
||||
1wincmd h
|
||||
wincmd w
|
||||
set nosplitbelow
|
||||
set nosplitright
|
||||
wincmd t
|
||||
set winheight=1 winwidth=1
|
||||
exe 'vert 1resize ' . ((&columns * 91 + 91) / 182)
|
||||
exe 'vert 2resize ' . ((&columns * 90 + 91) / 182)
|
||||
argglobal
|
||||
setlocal keymap=
|
||||
setlocal noarabic
|
||||
setlocal autoindent
|
||||
setlocal balloonexpr=
|
||||
setlocal nobinary
|
||||
setlocal bufhidden=
|
||||
setlocal buflisted
|
||||
setlocal buftype=
|
||||
setlocal nocindent
|
||||
setlocal cinkeys=0{,0},0),:,0#,!^F,o,O,e
|
||||
setlocal cinoptions=
|
||||
setlocal cinwords=if,else,while,do,for,switch
|
||||
setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
|
||||
setlocal commentstring=/*%s*/
|
||||
setlocal complete=.,w,b,u,t,i
|
||||
setlocal completefunc=
|
||||
setlocal nocopyindent
|
||||
setlocal nocursorcolumn
|
||||
setlocal nocursorline
|
||||
setlocal define=
|
||||
setlocal dictionary=
|
||||
setlocal nodiff
|
||||
setlocal equalprg=
|
||||
setlocal errorformat=
|
||||
setlocal expandtab
|
||||
if &filetype != 'groovy'
|
||||
setlocal filetype=groovy
|
||||
endif
|
||||
setlocal foldcolumn=0
|
||||
setlocal foldenable
|
||||
setlocal foldexpr=0
|
||||
setlocal foldignore=#
|
||||
setlocal foldlevel=0
|
||||
setlocal foldmarker={{{,}}}
|
||||
setlocal foldmethod=manual
|
||||
setlocal foldminlines=1
|
||||
setlocal foldnestmax=20
|
||||
setlocal foldtext=foldtext()
|
||||
setlocal formatexpr=
|
||||
setlocal formatoptions=tcq
|
||||
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
|
||||
setlocal grepprg=
|
||||
setlocal iminsert=2
|
||||
setlocal imsearch=2
|
||||
setlocal include=
|
||||
setlocal includeexpr=
|
||||
setlocal indentexpr=
|
||||
setlocal indentkeys=0{,0},:,0#,!^F,o,O,e
|
||||
setlocal noinfercase
|
||||
setlocal iskeyword=@,48-57,_,192-255
|
||||
setlocal keywordprg=
|
||||
setlocal nolinebreak
|
||||
setlocal nolisp
|
||||
setlocal nolist
|
||||
setlocal makeprg=
|
||||
setlocal matchpairs=(:),{:},[:]
|
||||
setlocal nomodeline
|
||||
setlocal modifiable
|
||||
setlocal nrformats=octal,hex
|
||||
set number
|
||||
setlocal number
|
||||
setlocal numberwidth=4
|
||||
setlocal omnifunc=
|
||||
setlocal path=
|
||||
setlocal nopreserveindent
|
||||
setlocal nopreviewwindow
|
||||
setlocal quoteescape=\\
|
||||
setlocal noreadonly
|
||||
setlocal norightleft
|
||||
setlocal rightleftcmd=search
|
||||
setlocal noscrollbind
|
||||
setlocal shiftwidth=4
|
||||
setlocal noshortname
|
||||
setlocal nosmartindent
|
||||
setlocal softtabstop=0
|
||||
setlocal nospell
|
||||
setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
|
||||
setlocal spellfile=
|
||||
setlocal spelllang=en
|
||||
setlocal statusline=
|
||||
setlocal suffixesadd=
|
||||
setlocal swapfile
|
||||
setlocal synmaxcol=3000
|
||||
if &syntax != 'groovy'
|
||||
setlocal syntax=groovy
|
||||
endif
|
||||
setlocal tabstop=4
|
||||
setlocal tags=
|
||||
setlocal textwidth=0
|
||||
setlocal thesaurus=
|
||||
setlocal nowinfixheight
|
||||
setlocal nowinfixwidth
|
||||
setlocal wrap
|
||||
setlocal wrapmargin=0
|
||||
silent! normal! zE
|
||||
let s:l = 40 - ((39 * winheight(0) + 39) / 78)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
40
|
||||
normal! 029l
|
||||
wincmd w
|
||||
argglobal
|
||||
edit test/com/jdbernard/pit/FileProjectTest.groovy
|
||||
setlocal keymap=
|
||||
setlocal noarabic
|
||||
setlocal autoindent
|
||||
setlocal balloonexpr=
|
||||
setlocal nobinary
|
||||
setlocal bufhidden=
|
||||
setlocal buflisted
|
||||
setlocal buftype=
|
||||
setlocal nocindent
|
||||
setlocal cinkeys=0{,0},0),:,0#,!^F,o,O,e
|
||||
setlocal cinoptions=
|
||||
setlocal cinwords=if,else,while,do,for,switch
|
||||
setlocal comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
|
||||
setlocal commentstring=/*%s*/
|
||||
setlocal complete=.,w,b,u,t,i
|
||||
setlocal completefunc=
|
||||
setlocal nocopyindent
|
||||
setlocal nocursorcolumn
|
||||
setlocal nocursorline
|
||||
setlocal define=
|
||||
setlocal dictionary=
|
||||
setlocal nodiff
|
||||
setlocal equalprg=
|
||||
setlocal errorformat=
|
||||
setlocal expandtab
|
||||
if &filetype != 'groovy'
|
||||
setlocal filetype=groovy
|
||||
endif
|
||||
setlocal foldcolumn=0
|
||||
setlocal foldenable
|
||||
setlocal foldexpr=0
|
||||
setlocal foldignore=#
|
||||
setlocal foldlevel=0
|
||||
setlocal foldmarker={{{,}}}
|
||||
setlocal foldmethod=manual
|
||||
setlocal foldminlines=1
|
||||
setlocal foldnestmax=20
|
||||
setlocal foldtext=foldtext()
|
||||
setlocal formatexpr=
|
||||
setlocal formatoptions=tcq
|
||||
setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}\\t\ ]\\s*
|
||||
setlocal grepprg=
|
||||
setlocal iminsert=2
|
||||
setlocal imsearch=2
|
||||
setlocal include=
|
||||
setlocal includeexpr=
|
||||
setlocal indentexpr=
|
||||
setlocal indentkeys=0{,0},:,0#,!^F,o,O,e
|
||||
setlocal noinfercase
|
||||
setlocal iskeyword=@,48-57,_,192-255
|
||||
setlocal keywordprg=
|
||||
setlocal nolinebreak
|
||||
setlocal nolisp
|
||||
setlocal nolist
|
||||
setlocal makeprg=
|
||||
setlocal matchpairs=(:),{:},[:]
|
||||
setlocal nomodeline
|
||||
setlocal modifiable
|
||||
setlocal nrformats=octal,hex
|
||||
set number
|
||||
setlocal number
|
||||
setlocal numberwidth=4
|
||||
setlocal omnifunc=
|
||||
setlocal path=
|
||||
setlocal nopreserveindent
|
||||
setlocal nopreviewwindow
|
||||
setlocal quoteescape=\\
|
||||
setlocal noreadonly
|
||||
setlocal norightleft
|
||||
setlocal rightleftcmd=search
|
||||
setlocal noscrollbind
|
||||
setlocal shiftwidth=4
|
||||
setlocal noshortname
|
||||
setlocal nosmartindent
|
||||
setlocal softtabstop=0
|
||||
setlocal nospell
|
||||
setlocal spellcapcheck=[.?!]\\_[\\])'\"\ \ ]\\+
|
||||
setlocal spellfile=
|
||||
setlocal spelllang=en
|
||||
setlocal statusline=
|
||||
setlocal suffixesadd=
|
||||
setlocal swapfile
|
||||
setlocal synmaxcol=3000
|
||||
if &syntax != 'groovy'
|
||||
setlocal syntax=groovy
|
||||
endif
|
||||
setlocal tabstop=4
|
||||
setlocal tags=
|
||||
setlocal textwidth=0
|
||||
setlocal thesaurus=
|
||||
setlocal nowinfixheight
|
||||
setlocal nowinfixwidth
|
||||
setlocal wrap
|
||||
setlocal wrapmargin=0
|
||||
silent! normal! zE
|
||||
let s:l = 154 - ((77 * winheight(0) + 39) / 78)
|
||||
if s:l < 1 | let s:l = 1 | endif
|
||||
exe s:l
|
||||
normal! zt
|
||||
154
|
||||
normal! 0
|
||||
wincmd w
|
||||
2wincmd w
|
||||
exe 'vert 1resize ' . ((&columns * 91 + 91) / 182)
|
||||
exe 'vert 2resize ' . ((&columns * 90 + 91) / 182)
|
||||
tabnext 1
|
||||
tabnext 6
|
||||
if exists('s:wipebuf')
|
||||
silent exe 'bwipe ' . s:wipebuf
|
||||
endif
|
||||
|
@ -4,54 +4,42 @@ import java.lang.IllegalArgumentException as IAE
|
||||
|
||||
public class FileIssue extends Issue {
|
||||
|
||||
File source
|
||||
protected File source
|
||||
|
||||
FileIssue(File file) {
|
||||
public FileIssue(File file) {
|
||||
|
||||
/* I do not like this construction, but groovy automatically
|
||||
* calls obj.setProperty(...) when you type obj.property = ...
|
||||
* There is an exception for fields accessed withing the class
|
||||
* that defines them, it does not catt eh setter/getter, but
|
||||
* this exception does not extend to subclasses accessing member
|
||||
* variables of their parent class. So instead of using Issue's
|
||||
* default constructor and setting the id, category, and priority
|
||||
* fields here, we have to let Issue's constructor initialize
|
||||
* those values.*/
|
||||
super('REPLACE_ME')
|
||||
|
||||
super((file.name =~ /(\d+)([bcft])(\d).*/)[0][1],
|
||||
Category.toCategory((file.name =~ /(\d+)([bcft])(\d).*/)[0][2]),
|
||||
(file.name =~ /(\d+)([bcft])(\d).*/)[0][3].toInteger())
|
||||
def matcher = file.name =~ /(\d{4})([bftc])(\d).*/
|
||||
if (!matcher) return null
|
||||
|
||||
//def matcher = file.name =~ /(\d{4})([bftc])(\d).*/
|
||||
/*if (!matcher) return null
|
||||
|
||||
id = matcher[0][1]
|
||||
category = Category.toCategory(matcher[0][2])
|
||||
priority = matcher[0][3].toInteger()*/
|
||||
super.@id = matcher[0][1]
|
||||
super.@category = Category.toCategory(matcher[0][2])
|
||||
super.@priority = matcher[0][3].toInteger()
|
||||
|
||||
this.source = file
|
||||
|
||||
file.withReader { title = it.readLine() }
|
||||
text = file.text
|
||||
}
|
||||
|
||||
void setCategory(Category c) {
|
||||
public void setCategory(Category c) {
|
||||
super.setCategory(c)
|
||||
source.renameTo(new File(source.canonicalFile.parentFile, getFilename()))
|
||||
}
|
||||
|
||||
void setPriority(int p) {
|
||||
public void setPriority(int p) {
|
||||
super.setPriority(p)
|
||||
source.renameTo(new File(source.canonicalFile.parentFile, getFilename()))
|
||||
}
|
||||
|
||||
String getFilename() { return makeFilename(id, category, priority) }
|
||||
public String getFilename() { return makeFilename(id, category, priority) }
|
||||
|
||||
static boolean isValidFilename(String name) {
|
||||
public static boolean isValidFilename(String name) {
|
||||
return name ==~ /(\d+)([bcft])(\d).*/
|
||||
}
|
||||
|
||||
static String makeFilename(String id, Category category, int priority) {
|
||||
public static String makeFilename(String id, Category category,
|
||||
int priority) {
|
||||
|
||||
// bounds check priority
|
||||
priority = Math.min(9, Math.max(0, priority))
|
||||
|
@ -2,9 +2,9 @@ package com.jdbernard.pit
|
||||
|
||||
class FileProject extends Project {
|
||||
|
||||
File source
|
||||
protected File source
|
||||
|
||||
FileProject(File dir) {
|
||||
public FileProject(File dir) {
|
||||
super(dir.name)
|
||||
|
||||
if (!dir.isDirectory())
|
||||
@ -32,10 +32,6 @@ class FileProject extends Project {
|
||||
}
|
||||
}
|
||||
|
||||
public void rename(String newName) {
|
||||
this.name = newName
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
super.setName(name)
|
||||
source.renameTo(new File(source.canonicalFile.parentFile, name))
|
||||
@ -54,15 +50,21 @@ class FileProject extends Project {
|
||||
id = (id.toInteger() + 1).toString().padLeft(id.length(), '0')
|
||||
}
|
||||
|
||||
def issueFile = new File(source, FileIssue.makeFilename(id, options.category, options.priority))
|
||||
def issueFile = new File(source, FileIssue.makeFilename(id,
|
||||
options.category, options.priority))
|
||||
|
||||
assert !issueFile.exists()
|
||||
|
||||
issueFile.createNewFile()
|
||||
issueFile.write(options.text)
|
||||
|
||||
return new FileIssue(issueFile)
|
||||
def issue = new FileIssue(issueFile)
|
||||
issues[(issue.id)] = issue
|
||||
|
||||
return issue
|
||||
}
|
||||
|
||||
@Override
|
||||
String toString() { return name }
|
||||
public String toString() { return name }
|
||||
|
||||
}
|
||||
|
@ -4,11 +4,10 @@ import java.lang.IllegalArgumentException as IAE
|
||||
|
||||
public class Issue {
|
||||
|
||||
String id
|
||||
Category category
|
||||
int priority
|
||||
String title
|
||||
String text
|
||||
protected String id
|
||||
protected Category category
|
||||
protected int priority
|
||||
protected String text
|
||||
|
||||
Issue(String id, Category c = Category.TASK, int p = 9) {
|
||||
this.id = id
|
||||
@ -16,15 +15,27 @@ public class Issue {
|
||||
this.priority = p
|
||||
}
|
||||
|
||||
void setCategory(Category c) {
|
||||
public String getId() { return id; }
|
||||
|
||||
public Category getCategory() { return category }
|
||||
|
||||
public void setCategory(Category c) {
|
||||
if (c == null)
|
||||
throw new IAE("Category cannot be null.")
|
||||
|
||||
this.category = c
|
||||
}
|
||||
|
||||
void setPriority(int p) { priority = Math.min(9, Math.max(0, p)) }
|
||||
public int getPriority() { return priority }
|
||||
|
||||
public void setPriority(int p) { priority = Math.min(9, Math.max(0, p)) }
|
||||
|
||||
public String getTitle() { return text.readLines()[0] }
|
||||
|
||||
public String getText() { return text }
|
||||
|
||||
public void setText(String t) { text = t }
|
||||
|
||||
@Override
|
||||
String toString() { return "${id}(${priority}): ${category} ${title}" }
|
||||
public String toString() { return "${id}(${priority}): ${category} ${title}" }
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.jdbernard.pit
|
||||
|
||||
public abstract class Project {
|
||||
|
||||
String name
|
||||
protected String name
|
||||
Map<String, Issue> issues = [:]
|
||||
Map<String, Project> projects = [:]
|
||||
|
||||
@ -22,6 +22,10 @@ public abstract class Project {
|
||||
c.call(p)
|
||||
}
|
||||
|
||||
public void setName(String name) { this.name = name }
|
||||
|
||||
public String getName() { return name }
|
||||
|
||||
@Override
|
||||
String toString() { return name }
|
||||
|
||||
|
@ -136,6 +136,7 @@ class FileProjectTest {
|
||||
assertEquals newIssue.text, 'A newly made bug report.\n'+
|
||||
'========================\n\n' +
|
||||
'Testing the Project.createNewIssue() method.'
|
||||
assertEquals rootProj.issues[(newIssue.id)], newIssue
|
||||
|
||||
//test defaults and creation of issue in an empty project
|
||||
newIssue = rootProj.projects.emptyproj.createNewIssue()
|
||||
@ -145,6 +146,9 @@ class FileProjectTest {
|
||||
assertEquals newIssue.text, 'Default issue title.\n' +
|
||||
'====================\n'
|
||||
|
||||
assertEquals rootProj.projects.emptyproj.issues[(newIssue.id)],
|
||||
newIssue
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -94,4 +94,12 @@ class FilterTest {
|
||||
|
||||
}
|
||||
|
||||
@Test void testAcceptsProjectsFilter() {
|
||||
|
||||
}
|
||||
|
||||
@Test void testCompositeFilter() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user