These are chat archives for anderspitman/dice-game

22nd
Apr 2016
Nguyen Dao
@ngdao
Apr 22 2016 04:58
Where is the CVS file created when built? Which file have that code to create the file? I'm curious. And are we converting user initial to uppercase for consistency?
found the CVS file
only the last question stands
Anders Pitman
@anderspitman
Apr 22 2016 07:20
Yeah I think converting to uppercase makes sense
But you and @mshannahnv can decide, since it's really a UI decision. We'll make the backend work with whatever you want.
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 13:18
Uppercase looks good
Christiaan Schmid
@chcschmid
Apr 22 2016 14:26
Do we have a test today?
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 15:14
In 360? No more tests until Finals week
Christiaan Schmid
@chcschmid
Apr 22 2016 15:15
k. I don't know why, but I woke up this morning and nearly had a heart attack... because I've been less than observant in class the last few days.
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 15:25
@hehe876 For #109 - I think there is a typo at the end of line 374, an 'x' at the end of the line. Everything else looks good!
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 16:23
@anderspitman I'm trying to fix the exceptions popping up when displaying player/game data on the CLI when no data exists
Select an option below:
1. Player Statistics
2. All Statistics
2
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
        at dice.ConcreteStatsProcessor.computeStats(StatsProcessor.java:194)
        at dice.ConcreteStatsProcessor.getAllStats(StatsProcessor.java:151)
        at Main.allStatistics(Main.java:240)
        at Main.statistics(Main.java:193)
        at Main.startScreen(Main.java:45)
        at Main.main(Main.java:9)
    /**
     * Allows aggregate statistics to be prepared for display.
     */
    public static void allStatistics() {
        //Obtain statistical data
        StatsProcessor stats = StatsProcessor.create();
        StatsData allStats = stats.getAllStats();

        if (statisticalDataExists(allStats.getTotalRolls())) {
            //Display aggregate statistics
            System.out.println("\n- All Statistics -");
            displayStatistics(allStats);
        }
    }

    /**
     * Displays an error if statistical data does not exist.
     * i.e. Nobody has played the game yet.
     * @param dataLength   Length of the statistical data (total rolls or number of past players).
     * @return             If the data equals zero (is empty).
     */
    public static boolean statisticalDataExists(int dataLength) {
        if (dataLength == 0) {
            System.out.println("\nError: Not enough player data to display statistics!");
            return false;
        }
        return true;
    }
This message was deleted
Seems to be freaking out on the StatsData allStats = stats.getAllStats(); line
I think, but getAllStats passes me a new StatsData
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 16:38
Unless it's freaking out about RollRecord record = records[0]; when dbLength = 0?
under StatsProcessor.java
Christiaan Schmid
@chcschmid
Apr 22 2016 16:42
No class today
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 16:44
Dang that's going to make it hard to go to recitation
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 16:49
I think I fixed it @anderspitman . Or at least put a band-aid on it
Made it so it doesn't compute the stats unless dbLength != 0
Nguyen Dao
@ngdao
Apr 22 2016 16:57
no class today yall
Anders Pitman
@anderspitman
Apr 22 2016 17:16
yhesssss
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 17:23
@anderspitman my pushes are not updating on github, what should I try to see what's going on?
Anders Pitman
@anderspitman
Apr 22 2016 17:24
tell me more specifically what you're running
and in what context
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 17:26
So, Initially I did git pull upstream master. and then git checkout cli. then made my code changes.. then git commit -a -m "message fixes anderspitman/dice-game#89"... then git push origin master
and no errors, but github wasn't updated
so then I tried reverting my commit, and then adding the files again and commiting
$ git push origin master
Username for 'https://github.com':
Password for 'https://mshannahnv@github.com':
To https://github.com/mshannahnv/dice-game
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/mshannahnv/dice-game'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
and then StackOverflow said to try this
$ git push -f origin master
Username for 'https://github.com':
Password for 'https://mshannahnv@github.com':
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/mshannahnv/dice-game
 + e3ce7c4...70b5769 master -> master (forced update)
and it's still not updated
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 17:32
and by updated I mean, it states my last commit was 7 days ago
Nguyen Dao
@ngdao
Apr 22 2016 17:36
so you're on cli branch locally and trying to push to the remote master?
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 17:36
yea
Nguyen Dao
@ngdao
Apr 22 2016 17:37
trying pushing it to the remote cli branch?
try*
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 17:39
Thanks @hehe876 . I haven't touched git in a week and I've already forgot everything!
That worked
Can somebody review #110 and let me know if it looks good?
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:13
@anderspitman I have no idea why this is failing locally and not in travis
Anders Pitman
@anderspitman
Apr 22 2016 20:16
@mshannahnv ah I see the tests aren't working for you period
I run them all the time, so yeah they're working for me
hm
It's probably having some issue with reading and writing the test database
if you look at the tests it's complaining about, you can see what they're doing. Maybe you can play with them and try to figure out what's breaking
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:19
Yeah they look like they should work
Anders Pitman
@anderspitman
Apr 22 2016 20:20
run the tests like this ./gradlew check --info. That should tell you more about how they're failing
for example, addRollMultiple. Is it writing the file at all? Is it the wrong length, or just 0? etc
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:20
Gradle Test Executor 1 started executing tests.

TestDatabase > addRollMultiple FAILED
    java.lang.AssertionError:
    Expected: <4>
         but: was <5>
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:956)
        at org.junit.Assert.assertThat(Assert.java:923)
        at TestDatabase.addRollMultiple(TestDatabase.java:90)

TestDiceGame > rollSavesToDatabase FAILED
    java.lang.AssertionError:
    Expected: <1>
         but: was <3>
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:956)
        at org.junit.Assert.assertThat(Assert.java:923)
        at TestDiceGame.rollSavesToDatabase(TestDiceGame.java:290)
Gradle Test Executor 1 finished executing tests.
Anders Pitman
@anderspitman
Apr 22 2016 20:21
interesting
longer than expected
you're sure this is clean upstream master, right? git diff has no output and git status shows no changes or untracked files that could affect things?
after you run the tests, what are the contents of src/test/resources/tempTestDb.csv?
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:24
"CHS","1","1","6","0"
"CHS","1","1","6","6"
"CHS","1","1","3","9"
"CHS","1","3","7","16"
"TAP","2","3","12","12"
which git diff would be best to display?
git status is clear
Anders Pitman
@anderspitman
Apr 22 2016 20:27
try running it like this: ./gradlew test --tests TestDatabase.addRollMultiple
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:28
Build success - am I supposed to do check instead of test?
Anders Pitman
@anderspitman
Apr 22 2016 20:28
you can run git diff without any arguments and it will just show you any uncommitted changes on whatever branch you're on
no test is correct
hm
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:29
So, it's supposed to write 4 to the DB?
and there's 5?
Is there a way I can clear the DB?
Anders Pitman
@anderspitman
Apr 22 2016 20:29
wait
this doesn't make any sense at all
something changed since the last time you posted the error
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:30
What do you mean
Anders Pitman
@anderspitman
Apr 22 2016 20:30
if it says addRollMultiple is failing, then ./gradlew test --tests TestDatabase.addRollMultiple will also fail
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:31
my git diff and git status are clear
Hannah@Hannah-PC ~/Documents/GitHub/dice-game
$ git diff

Hannah@Hannah-PC ~/Documents/GitHub/dice-game
$ git status
On branch unit-test
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        cli/build/
        gui/build/
        shared/build/
        shared/src/test/resources/tempTestDb.csv
        shared/src/test/resources/tempTestDbDiceGame.csv

nothing added to commit but untracked files present (use "git add" to track)
Anders Pitman
@anderspitman
Apr 22 2016 20:31
if you run
./gradlew test
./gradlew test --tests TestDatabase.addRollMultiple
back to back, the first one fails and the second doesn't?
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:32
Hannah@Hannah-PC ~/Documents/GitHub/dice-game
$ ./gradlew test
:shared:compileJava UP-TO-DATE
:shared:processResources UP-TO-DATE
:shared:classes UP-TO-DATE
:shared:jar UP-TO-DATE
:cli:compileJava UP-TO-DATE
:cli:processResources UP-TO-DATE
:cli:classes UP-TO-DATE
:cli:compileTestJava UP-TO-DATE
:cli:processTestResources UP-TO-DATE
:cli:testClasses UP-TO-DATE
:cli:test UP-TO-DATE
:gui:compileJava UP-TO-DATE
:gui:processResources UP-TO-DATE
:gui:classes UP-TO-DATE
:gui:compileTestJava UP-TO-DATE
:gui:processTestResources UP-TO-DATE
:gui:testClasses UP-TO-DATE
:gui:test UP-TO-DATE
:shared:compileTestJava UP-TO-DATE
:shared:processTestResources
:shared:testClasses
:shared:test

TestDatabase > addRollMultiple FAILED
    java.lang.AssertionError at TestDatabase.java:90

TestDiceGame > rollSavesToDatabase FAILED
    java.lang.AssertionError at TestDiceGame.java:290

36 tests completed, 2 failed
:shared:test FAILED
This message was deleted
Hannah@Hannah-PC ~/Documents/GitHub/dice-game
$ ./gradlew test --tests TestDatabase.addRollMultiple
:shared:compileJava UP-TO-DATE
:shared:processResources UP-TO-DATE
:shared:classes UP-TO-DATE
:shared:jar UP-TO-DATE
:cli:compileJava UP-TO-DATE
:cli:processResources UP-TO-DATE
:cli:classes UP-TO-DATE
:cli:compileTestJava UP-TO-DATE
:cli:processTestResources UP-TO-DATE
:cli:testClasses UP-TO-DATE
:cli:test UP-TO-DATE
:gui:compileJava UP-TO-DATE
:gui:processResources UP-TO-DATE
:gui:classes UP-TO-DATE
:gui:compileTestJava UP-TO-DATE
:gui:processTestResources UP-TO-DATE
:gui:testClasses UP-TO-DATE
:gui:test UP-TO-DATE
:shared:compileTestJava UP-TO-DATE
:shared:processTestResources
:shared:testClasses
:shared:test

BUILD SUCCESSFUL

Total time: 17.324 secs
Anders Pitman
@anderspitman
Apr 22 2016 20:34
this is retarded
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:34
Is it possible that somehow TestDatabase isn't included in the ./gradlew
<- no idea what I'm talking about, just thinking outload
outloud
Anders Pitman
@anderspitman
Apr 22 2016 20:35
comment out all the tests except addRollMultiple in that file and run ./gradlew test again
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:37
Hannah@Hannah-PC ~/Documents/GitHub/dice-game
$ ./gradlew test
:shared:compileJava UP-TO-DATE
:shared:processResources UP-TO-DATE
:shared:classes UP-TO-DATE
:shared:jar UP-TO-DATE
:cli:compileJava UP-TO-DATE
:cli:processResources UP-TO-DATE
:cli:classes UP-TO-DATE
:cli:compileTestJava UP-TO-DATE
:cli:processTestResources UP-TO-DATE
:cli:testClasses UP-TO-DATE
:cli:test UP-TO-DATE
:gui:compileJava UP-TO-DATE
:gui:processResources UP-TO-DATE
:gui:classes UP-TO-DATE
:gui:compileTestJava UP-TO-DATE
:gui:processTestResources UP-TO-DATE
:gui:testClasses UP-TO-DATE
:gui:test UP-TO-DATE
:shared:compileTestJava
:shared:processTestResources
:shared:testClasses
:shared:test

TestDiceGame > rollSavesToDatabase FAILED
    java.lang.AssertionError at TestDiceGame.java:290

32 tests completed, 1 failed
:shared:test FAILED
Anders Pitman
@anderspitman
Apr 22 2016 20:37

Somehow an extra

"CHS","1","1","6","0"

line is getting added to the top of the database

ah as I suspected
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:38
Yea.. from AddRollSingle?
Anders Pitman
@anderspitman
Apr 22 2016 20:38
one of the other tests is interferring
uncomment just addRollSingle and run again
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:39
Failed
Anders Pitman
@anderspitman
Apr 22 2016 20:39
k
basically it looks like the code at the top of addRollMultiple which is supposed to delete the file if it exists isn't working
oh
maybe that's because it's hard-coded as a unix path
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:40
That would explain why it doesn't work on mine
Anders Pitman
@anderspitman
Apr 22 2016 20:41
are you on cygwin?
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:41
yea
Anders Pitman
@anderspitman
Apr 22 2016 20:41
I would expect that to still work
but definitely won't work on windows
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:41
Should I try switching the slashes?
Just to see
Anders Pitman
@anderspitman
Apr 22 2016 20:42
whatever you want
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:42
Not sure if there's a way to set a generic path, or if it's worth it
Anders Pitman
@anderspitman
Apr 22 2016 20:43
there is
wasn't able to get it working in a few minutes so I just gave up
but I don't think that's the problem here. Cygwin is obviously able to use the path, because it's reading and writing the file just fine. Just deleting is working
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:43
yeah it's still failing
Anders Pitman
@anderspitman
Apr 22 2016 20:43
I can fix the windows test problem later
ok I think I'm onto a solution
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:50
yeah f.delete() is returning false
Anders Pitman
@anderspitman
Apr 22 2016 20:52
cool
put a try/catch around it and run with --info and see what exception it's throwing
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 20:57
I can't see an exception with --info
Not sure if it's throwing an exception
If I do --stacktrace
it states * Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':shared:test'.
Anders Pitman
@anderspitman
Apr 22 2016 21:17
right but you can print the exception and you need --info to see what you print
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 21:18
I'll paste the gist to you
I couldn't see the exception, but it's a wall of text so maybe I'm missing it
Anders Pitman
@anderspitman
Apr 22 2016 21:18
Just try using Files.delete like the SO answer recommends
that should throw a useful exception
seems like the one we're using is useless anyway
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 21:20
Gradle Test Executor 1 started executing tests.

TestDatabase > addRollMultiple STANDARD_OUT
    Error opening file

TestDatabase > addRollMultiple FAILED
    java.lang.NullPointerException
        at java.io.Writer.<init>(Writer.java:88)
        at java.io.PrintWriter.<init>(PrintWriter.java:113)
        at java.io.PrintWriter.<init>(PrintWriter.java:100)
        at com.opencsv.CSVWriter.<init>(CSVWriter.java:137)
        at com.opencsv.CSVWriter.<init>(CSVWriter.java:109)
        at com.opencsv.CSVWriter.<init>(CSVWriter.java:97)
        at com.opencsv.CSVWriter.<init>(CSVWriter.java:86)
        at com.opencsv.CSVWriter.<init>(CSVWriter.java:76)
        at dice.ConcreteDatabase.getWriter(Database.java:177)
        at dice.ConcreteDatabase.addRoll(Database.java:128)
        at TestDatabase.addRollMultiple(TestDatabase.java:85)

TestDiceGame > rollSavesToDatabase FAILED
    java.lang.AssertionError:
    Expected: <1>
         but: was <3>
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:956)
        at org.junit.Assert.assertThat(Assert.java:923)
        at TestDiceGame.rollSavesToDatabase(TestDiceGame.java:290)
Gradle Test Executor 1 finished executing tests.

37 tests completed, 2 failed
I see the exception now :D
Switching it to use nio.Files instead pulls up another error.
Gradle Test Executor 1 started executing tests.

TestDatabase > addRollMultiple STANDARD_ERROR
    java.nio.file.FileAlreadyExistsException: src\test\resources\tempTestDb.csv
        at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:81)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
        at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
        at java.nio.file.Files.newByteChannel(Files.java:361)
        at java.nio.file.Files.createFile(Files.java:632)
        at TestDatabase.addRollMultiple(TestDatabase.java:79)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:112)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:56)
        at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:66)
        at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
        at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
        at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
        at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:109)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.messaging.remote.inter
This is such a mess, I don't know why this is only locally
Could just be a windows permission thing
:cry:
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 21:27
Well
I may have fixed it
Anders Pitman
@anderspitman
Apr 22 2016 21:31
?
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 21:31
Nope
Nguyen Dao
@ngdao
Apr 22 2016 21:32
running into trouble at my repo as well
Anders Pitman
@anderspitman
Apr 22 2016 21:32
why is it throwing at line 79?
the file is deleted on line 77
Nguyen Dao
@ngdao
Apr 22 2016 21:34
getting this exception when I press the stop button
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 1
    at dice.ConcreteDatabase.getAllRecords(Database.java:88)
    at dice.DiceGame.getNextGameId(DiceGame.java:92)
    at dice.DiceGame.roll(DiceGame.java:54)
    at DiceGameGUI.btnStopActionPerformed(DiceGameGUI.java:317)
    at DiceGameGUI.access$200(DiceGameGUI.java:19)
    at DiceGameGUI$3.actionPerformed(DiceGameGUI.java:94)
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 21:35
The best I've been able to get it is
by converting to nio.Files
and then swapping the delete and create,
Anders Pitman
@anderspitman
Apr 22 2016 21:36
idk
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 21:36
But that makes no sense
Anders Pitman
@anderspitman
Apr 22 2016 21:36
I think you have all the tools to track it down though
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 21:36
We wouldn't want to delete first
No way
I've been at this for
Anders Pitman
@anderspitman
Apr 22 2016 21:37
well as long as the logic of the test makes sense to you, you should be able to fix it
  1. Delete the old file if it exists
  2. Write the data to the file
  3. Verify the results
you just need to fiddle with it until you're sure which part is failing
we think its the delete
so you need to work with it until you're 100% sure that file is being deleted correctly
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 21:38
Yea it's delete
Anders Pitman
@anderspitman
Apr 22 2016 21:38
you can comment everything else out and just solve that problem
you can even make a separate java problem completely separate from dice-game that's only job is to delete a file on cygwin, and make sure that program works
etc etc
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 21:39
But is it only windows environments?
Anders Pitman
@anderspitman
Apr 22 2016 21:39
doesn't matter
you're a core developer and we need you to be able to run the tests
one way or another
I don't care what the final solution is
but ideally it would involve being able to run the same tests and every platform we support for running the game
@hehe876 gonna need a lot more information than that to be able to help you
stop button is working fine for me on latest master
if it's not working for you on latest master we have a problem
Nguyen Dao
@ngdao
Apr 22 2016 21:46
yeah it's weird! I'll work on it
Nguyen Dao
@ngdao
Apr 22 2016 21:58
my lastest branch (GUI-FineTune) works fine, but not my master, even after the merge, and git diff master doens't show anything
after trying to merge the branch with master, the branch now have that bug too :worried:
Anders Pitman
@anderspitman
Apr 22 2016 22:00
it's unlikely that whatever you did on the branch accidentally fixed a bug
you'll need to track down whatever the issue is on master. Don't worry about the branch for now. Work off of master (you can create a new branch for debugging this. branches are cheap). Seems like there's a decent chance you're having a similar issue to whatever Hannah is running into with file problems.
also try running our latest release JAR and see if that works
@mshannahnv are you having the same problem as @hehe876 when you run the GUI off master?
Nguyen Dao
@ngdao
Apr 22 2016 22:04
ok
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 22:06
I'm not getting that exception when I press the stop button
Nguyen Dao
@ngdao
Apr 22 2016 22:08
I deleted the cvs file, and everything is ok again...
Anders Pitman
@anderspitman
Apr 22 2016 22:10
it's csv
but that's good news
must have got corrupted somehow
Anders Pitman
@anderspitman
Apr 22 2016 22:15
I'm not planning to work on this until midnight again. I'll be available for the next couple hours. Anything we ship tonight needs to be tested on all platforms before being merged.
I think we need to update our review process to include running any changes to the GUI and the CLI on windows and linux, since there aren't any unit tests for that code
Nguyen Dao
@ngdao
Apr 22 2016 22:17
I don't think we need to ship anything tonight
Anders Pitman
@anderspitman
Apr 22 2016 22:17
that means in most cases having 2 people review each PR
there's no milestone at all?
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 22:17
Well I've been stuck on this error for the past hour
Anders Pitman
@anderspitman
Apr 22 2016 22:17
or "deliverable" or whatever
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 22:17
TestDatabase > addRollMultiple STANDARD_ERROR
    java.nio.file.FileSystemException: src\test\resources\tempTestDb.csv: The process cannot access the file because it is being used by another process.
Anders Pitman
@anderspitman
Apr 22 2016 22:18
@mshannahnv that's good news
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 22:18
Not really :O
I can't get it to go away
Anders Pitman
@anderspitman
Apr 22 2016 22:18
that's ok
just means we definitely need to change how we're doing the test I think
but now we know the issue
which was the goal
also explains the difference between Windows and Linux
as you postulated, obviously the permissions are different
at least when it comes to a file already in use
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 22:20
Well this was after I converted it to nio.file.Files
So I'm curious if you'd get the same error
Anders Pitman
@anderspitman
Apr 22 2016 22:20
doubt it
but I'll try
post the code for converting it (gist if necessary)
Anders Pitman
@anderspitman
Apr 22 2016 22:23
thx
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 22:24
I'm not sure if the file needs to be deleted before Database.create()... but I've been trying it both ways
and commenting out addRollSingle() makes that exception go away... it doesn't like creating/deleting that file across those two tests
Anders Pitman
@anderspitman
Apr 22 2016 22:26
mine works fine
here's my guess
when the first test runs, Database opens a handle to the file, which does not get released when the test finishes for some reason, which blocks the second test
Anders Pitman
@anderspitman
Apr 22 2016 22:31
if you can review and merge #112 that might fix it
even if it doesn't the changes I made need to go in
try merging upstream master into your current branch and see if that does it
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 22:34
Looks like it fixed it
Anders Pitman
@anderspitman
Apr 22 2016 22:34
excellent
if we were doing this properly we would now create a unit test to catch this problem on all platforms, but I'm too lazy
so back to the original task of adding a unit test for your PR. You can run ./gradlew check with no problems now?
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 22:39
Having a problem with my test
TestStatsProcessor > getEmptyAllStats FAILED
    java.lang.AssertionError:
    Expected: <0>
         but: was <5>
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.junit.Assert.assertThat(Assert.java:956)
        at org.junit.Assert.assertThat(Assert.java:923)
        at TestStatsProcessor.getEmptyAllStats(TestStatsProcessor.java:42)
s failing at
assertThat(stats.getTotalRolls(), equalTo(0));
It
Is it possible the above test is conflicting again?
    @Test
    public void getAllStats() {
        StatsData stats = proc.getAllStats();

        assertThat(stats.getTotalRolls(), equalTo(5));
        assertEquals(1.666667, stats.getAvgRollsPerGame(), 0.00001);
        assertThat(stats.getCumulativeScore(), equalTo(46));
        assertThat(stats.getAvgScore(), equalTo(15.0));
        assertThat(stats.getAvgNumDiceUsed(), equalTo(2.0));
    }

    @Test
    public void getEmptyAllStats() {
        StatsData stats = proc.getAllStats();

        assertThat(stats.getTotalRolls(), equalTo(0));
        assertThat(stats.getAvgRollsPerGame(), equalTo(0.0));
        assertThat(stats.getCumulativeScore(), equalTo(0));
        assertThat(stats.getAvgScore(), equalTo(0.0));
        assertThat(stats.getAvgNumDiceUsed(), equalTo(0.0));
        assertThat(stats.getMaxScore(), equalTo(0));
    }
I should probably just create a new StatsProcessor in my test?
Or I'll position the test to be the first to hit
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 22:44
Nevermind, commenting all the other tests still pops up 5
@Before
    public void setUp() {
        Database db = Database.create("mock", "dummyFilename");
        proc = StatsProcessor.create("concrete", db);
    }
Should this be "concrete" ?
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 22:50
Looks like it's always creating a mock DB
So my test requires it to run off concrete database, but hte other tests are dependent on mock DB
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 22:56
Do you want all the unit tests to run off concrete?
I'm pushing what I got, I just put a concrete db in my getEmptyAllStats to override the setUp()
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 23:03
Nothing is due until next week, so I guess I'm done with this for tonight :)
Anders Pitman
@anderspitman
Apr 22 2016 23:09
sorry had some meat on the stove
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 23:32
@anderspitman changing "dummyFileName" to "src/test/resources/tempTestDb.csv" causes my test to fail.. do I need to delete the csv in my unit test?
Anders Pitman
@anderspitman
Apr 22 2016 23:32
yeah follow the same pattern as TestDatabase
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 23:35
Okay pushed
Did you want ichiba.csv test commited?
I may have uncommented
Anders Pitman
@anderspitman
Apr 22 2016 23:37
ah yeah I think I had it commented before
you wanna go ahead and just remove it entirely?
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 23:37
Ok
Should be good
Anders Pitman
@anderspitman
Apr 22 2016 23:40
excellent, thx. merged
Hannah Van Den Bosch
@mshannahnv
Apr 22 2016 23:41
Thanks for the help
craziest PR ever
Anders Pitman
@anderspitman
Apr 22 2016 23:42
lol
welcome to the real world